Accepting request 692900 from home:jayvdb:branches:devel:languages:python:django

- Add test_clear_site_cache-sort.patch to workaround flaky test
- Add bcond_with for selenium and memcached, as those tests are inactive,
  and add missing dependencies and setup for selenium testing
- Move removal of executable bit from a JavaScript file to %prep
- Fix fdupes

OBS-URL: https://build.opensuse.org/request/show/692900
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:django/python-Django?expand=0&rev=26
This commit is contained in:
Ondřej Súkup 2019-04-12 14:20:43 +00:00 committed by Git OBS Bridge
parent f79336dd46
commit 4b16139371
3 changed files with 49 additions and 21 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Apr 10 07:55:46 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Add test_clear_site_cache-sort.patch to workaround flaky test
- Add bcond_with for selenium and memcached, as those tests are inactive,
and add missing dependencies and setup for selenium testing
- Move removal of executable bit from a JavaScript file to %prep
- Fix fdupes
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Apr 3 11:21:56 UTC 2019 - Ondřej Súkup <mimi.vx@gmail.com> Wed Apr 3 11:21:56 UTC 2019 - Ondřej Súkup <mimi.vx@gmail.com>

View File

@ -16,6 +16,9 @@
# #
# Selenium and memcached are not operational
%bcond_with selenium
%bcond_with memcached
%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1 %define skip_python2 1
Name: python-Django Name: python-Django
@ -31,6 +34,7 @@ Source1: https://www.djangoproject.com/m/pgp/Django-%{version}.checksum.t
Source2: %{name}.keyring Source2: %{name}.keyring
Source99: python-Django-rpmlintrc Source99: python-Django-rpmlintrc
Patch0: i18n_test.patch Patch0: i18n_test.patch
Patch1: test_clear_site_cache-sort.patch
BuildRequires: %{python_module Jinja2 >= 2.9.2} BuildRequires: %{python_module Jinja2 >= 2.9.2}
BuildRequires: %{python_module Pillow} BuildRequires: %{python_module Pillow}
BuildRequires: %{python_module PyYAML} BuildRequires: %{python_module PyYAML}
@ -40,18 +44,24 @@ BuildRequires: %{python_module bcrypt}
BuildRequires: %{python_module docutils} BuildRequires: %{python_module docutils}
BuildRequires: %{python_module geoip2} BuildRequires: %{python_module geoip2}
BuildRequires: %{python_module numpy} BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pylibmc}
BuildRequires: %{python_module python-memcached >= 1.59}
BuildRequires: %{python_module pytz} BuildRequires: %{python_module pytz}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module sqlparse} BuildRequires: %{python_module sqlparse}
BuildRequires: %{python_module tblib} BuildRequires: %{python_module tblib}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
# python-selenium is supported only on the Intel architecture %if %{with memcached}
# Django testsuite runs just fine without, just skips the affected tests BuildRequires: %{python_module pylibmc}
BuildRequires: %{python_module python-memcached >= 1.59}
%endif
%if %{with selenium}
# python-selenium is supported only on the Intel architecture.
# Additionally chromedriver is only available on x86_64.
%ifarch %{ix86} x86_64 %ifarch %{ix86} x86_64
BuildRequires: %{python_module selenium} BuildRequires: %{python_module selenium}
BuildRequires: chromedriver
BuildRequires: xvfb-run
%endif
%endif %endif
Requires: python-Pillow Requires: python-Pillow
Requires: python-argon2-cffi >= 16.1.0 Requires: python-argon2-cffi >= 16.1.0
@ -86,6 +96,8 @@ echo "`grep -e '^[0-9a-f]\{64\} Django-%{version}.tar.gz' %{SOURCE1} | cut -c1-
%setup -q -n Django-%{version} %setup -q -n Django-%{version}
%patch0 -p1 %patch0 -p1
%patch1 -p1
chmod a-x django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.js
%build %build
%python_build %python_build
@ -97,29 +109,23 @@ echo "`grep -e '^[0-9a-f]\{64\} Django-%{version}.tar.gz' %{SOURCE1} | cut -c1-
%python_clone -a %{buildroot}%{_bindir}/django-admin %python_clone -a %{buildroot}%{_bindir}/django-admin
%{python_expand install -D -m 0644 extras/django_bash_completion %{buildroot}%%{_datadir}/bash-completion/completions/django_bash_completion-%{$python_bin_suffix}.sh %{python_expand install -D -m 0644 extras/django_bash_completion %{buildroot}%%{_datadir}/bash-completion/completions/django_bash_completion-%{$python_bin_suffix}.sh
pushd %{buildroot}%{$python_sitelib}
chmod a-x django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.js
# Fix wrong-script-interpreter # Fix wrong-script-interpreter
sed -i "s|^#!%{_bindir}/env python$|#!%{__$python}|" django/bin/django-admin.py sed -i "s|^#!%{_bindir}/env python$|#!%{__$python}|" \
sed -i "s|^#!%{_bindir}/env python$|#!%{__$python}|" django/conf/project_template/manage.py-tpl %{buildroot}%{$python_sitelib}/django/bin/django-admin.py \
%fdupes . %{buildroot}%{$python_sitelib}/django/conf/project_template/manage.py-tpl
# Deduplicating files can generate a RPMLINT warning for pyc mtime %fdupes %{buildroot}%{$python_sitelib}/django/
$python -m compileall -d %{$python_sitelib} django/bin/ %fdupes %{buildroot}%{$python_sitelib}/Django-%{version}-py*.egg-info/
$python -O -m compileall -d %{$python_sitelib} django/bin/
$python -m compileall -d %{$python_sitelib} django/conf/project_template/
$python -O -m compileall -d %{$python_sitelib} django/conf/project_template/
$python -m compileall -d %{$python_sitelib} django/conf/locale/
$python -O -m compileall -d %{$python_sitelib} django/conf/locale/
$python -m compileall -d %{$python_sitelib} django/conf/locale/*/
$python -O -m compileall -d %{$python_sitelib} django/conf/locale/*/
%fdupes django/bin/
popd
} }
%check %check
export LANG=en_US.UTF8 export LANG=en_US.UTF8
export PYTHONDONTWRITEBYTECODE=1 export PYTHONDONTWRITEBYTECODE=1
%if %{with selenium}
export PATH=%{_libdir}/chromium:$PATH
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} xvfb-run $python tests/runtests.py -v 2 --selenium=chome
%else
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python tests/runtests.py %python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python tests/runtests.py
%endif
%post %post
%{python_install_alternative django-admin.py django-admin} %{python_install_alternative django-admin.py django-admin}

View File

@ -0,0 +1,13 @@
Index: Django-2.2/tests/sites_tests/tests.py
===================================================================
--- Django-2.2.orig/tests/sites_tests/tests.py
+++ Django-2.2/tests/sites_tests/tests.py
@@ -162,7 +162,7 @@ class SitesFrameworkTests(TestCase):
self.assertEqual(models.SITE_CACHE, {})
get_current_site(request)
expected_cache = {self.site.id: self.site}
- self.assertEqual(models.SITE_CACHE, expected_cache)
+ self.assertCountEqual(models.SITE_CACHE, expected_cache)
with self.settings(SITE_ID=''):
get_current_site(request)