From 4b16139371e3e5c287379709050f6479d6342b0402adbd93d753057bba486af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20S=C3=BAkup?= Date: Fri, 12 Apr 2019 14:20:43 +0000 Subject: [PATCH] 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 --- python-Django.changes | 9 ++++++ python-Django.spec | 48 ++++++++++++++++++-------------- test_clear_site_cache-sort.patch | 13 +++++++++ 3 files changed, 49 insertions(+), 21 deletions(-) create mode 100644 test_clear_site_cache-sort.patch diff --git a/python-Django.changes b/python-Django.changes index 4cf9682..085a5df 100644 --- a/python-Django.changes +++ b/python-Django.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Apr 10 07:55:46 UTC 2019 - John Vandenberg + +- 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 diff --git a/python-Django.spec b/python-Django.spec index f507f0f..801d538 100644 --- a/python-Django.spec +++ b/python-Django.spec @@ -16,6 +16,9 @@ # +# Selenium and memcached are not operational +%bcond_with selenium +%bcond_with memcached %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-Django @@ -31,6 +34,7 @@ Source1: https://www.djangoproject.com/m/pgp/Django-%{version}.checksum.t Source2: %{name}.keyring Source99: python-Django-rpmlintrc Patch0: i18n_test.patch +Patch1: test_clear_site_cache-sort.patch BuildRequires: %{python_module Jinja2 >= 2.9.2} BuildRequires: %{python_module Pillow} BuildRequires: %{python_module PyYAML} @@ -40,18 +44,24 @@ BuildRequires: %{python_module bcrypt} BuildRequires: %{python_module docutils} BuildRequires: %{python_module geoip2} BuildRequires: %{python_module numpy} -BuildRequires: %{python_module pylibmc} -BuildRequires: %{python_module python-memcached >= 1.59} BuildRequires: %{python_module pytz} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module sqlparse} BuildRequires: %{python_module tblib} BuildRequires: fdupes BuildRequires: python-rpm-macros -# python-selenium is supported only on the Intel architecture -# Django testsuite runs just fine without, just skips the affected tests +%if %{with memcached} +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 BuildRequires: %{python_module selenium} +BuildRequires: chromedriver +BuildRequires: xvfb-run +%endif %endif Requires: python-Pillow 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} %patch0 -p1 +%patch1 -p1 +chmod a-x django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.js %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_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 -sed -i "s|^#!%{_bindir}/env python$|#!%{__$python}|" django/bin/django-admin.py -sed -i "s|^#!%{_bindir}/env python$|#!%{__$python}|" django/conf/project_template/manage.py-tpl -%fdupes . -# Deduplicating files can generate a RPMLINT warning for pyc mtime -$python -m compileall -d %{$python_sitelib} django/bin/ -$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 +sed -i "s|^#!%{_bindir}/env python$|#!%{__$python}|" \ + %{buildroot}%{$python_sitelib}/django/bin/django-admin.py \ + %{buildroot}%{$python_sitelib}/django/conf/project_template/manage.py-tpl +%fdupes %{buildroot}%{$python_sitelib}/django/ +%fdupes %{buildroot}%{$python_sitelib}/Django-%{version}-py*.egg-info/ } %check export LANG=en_US.UTF8 export PYTHONDONTWRITEBYTECODE=1 -%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python tests/runtests.py +%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 +%endif %post %{python_install_alternative django-admin.py django-admin} diff --git a/test_clear_site_cache-sort.patch b/test_clear_site_cache-sort.patch new file mode 100644 index 0000000..513ce31 --- /dev/null +++ b/test_clear_site_cache-sort.patch @@ -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)