diff options
author | Lancelot SIX <lsix@lancelotsix.com> | 2020-03-06 15:41:49 +0100 |
---|---|---|
committer | Jon <jonringer@users.noreply.github.com> | 2020-03-06 12:34:54 -0800 |
commit | 75087d8882c78707fdcc820145680fad27e1386d (patch) | |
tree | ff1812256c0c6ae2cc3ab1d9de67ece1fba63d55 | |
parent | 4babdd0bac48fc36cd7b2756320ab9982e434d02 (diff) |
python3Packages.django_compat: fix tests and re-enable
-rw-r--r-- | pkgs/development/python-modules/django-compat/default.nix | 6 | ||||
-rw-r--r-- | pkgs/development/python-modules/django-compat/fix-tests.diff | 61 |
2 files changed, 65 insertions, 2 deletions
diff --git a/pkgs/development/python-modules/django-compat/default.nix b/pkgs/development/python-modules/django-compat/default.nix index c492e65854a7f..9caa1cb730ba8 100644 --- a/pkgs/development/python-modules/django-compat/default.nix +++ b/pkgs/development/python-modules/django-compat/default.nix @@ -5,8 +5,6 @@ buildPythonPackage rec { pname = "django-compat"; version = "1.0.15"; - # django-compat requires django < 2.0 - disabled = stdenv.lib.versionAtLeast django.version "2.0"; # the pypi packages don't include everything required for the tests src = fetchFromGitHub { @@ -16,6 +14,10 @@ buildPythonPackage rec { sha256 = "1pr6v38ahrsvxlgmcx69s4b5q5082f44gzi4h3c32sccdc4pwqxp"; }; + patches = [ + ./fix-tests.diff + ]; + checkPhase = '' runHook preCheck diff --git a/pkgs/development/python-modules/django-compat/fix-tests.diff b/pkgs/development/python-modules/django-compat/fix-tests.diff new file mode 100644 index 0000000000000..76d7852c57a9c --- /dev/null +++ b/pkgs/development/python-modules/django-compat/fix-tests.diff @@ -0,0 +1,61 @@ +diff -Nur a/compat/tests/settings.py b/compat/tests/settings.py +--- a/compat/tests/settings.py 2020-03-06 15:32:07.548482597 +0100 ++++ b/compat/tests/settings.py 2020-03-06 15:36:45.270265678 +0100 +@@ -16,10 +16,17 @@ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', ++ 'django.contrib.messages', + 'compat', + 'compat.tests.test_app', + ] + ++MIDDLEWARE = ( ++ 'django.contrib.auth.middleware.AuthenticationMiddleware', ++ 'django.contrib.messages.middleware.MessageMiddleware', ++ 'django.contrib.sessions.middleware.SessionMiddleware', ++) ++ + MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', +@@ -43,6 +50,7 @@ + 'django.template.context_processors.i18n', + 'django.template.context_processors.tz', + 'django.template.context_processors.request', ++ 'django.contrib.messages.context_processors.messages', + ], + 'loaders': [ + 'django.template.loaders.filesystem.Loader', +diff -Nur a/compat/tests/test_compat.py b/compat/tests/test_compat.py +--- a/compat/tests/test_compat.py 2020-03-06 15:32:07.548482597 +0100 ++++ b/compat/tests/test_compat.py 2020-03-06 15:37:39.202835075 +0100 +@@ -9,7 +9,7 @@ + from django.core.serializers.json import DjangoJSONEncoder + from django.test import TestCase, SimpleTestCase + from django.test.client import RequestFactory +-from django.contrib.auth.views import logout ++from django.contrib.auth.views import auth_logout + try: + from django.urls import NoReverseMatch + except ImportError: +@@ -103,7 +103,7 @@ + Tests that passing a view name to ``resolve_url`` will result in the + URL path mapping to that view name. + """ +- resolved_url = resolve_url(logout) ++ resolved_url = resolve_url(auth_logout) + self.assertEqual('/accounts/logout/', resolved_url) + + ''' +Les fichiers binaires a/compat/tests/.test_compat.py.swp et b/compat/tests/.test_compat.py.swp sont différents +diff -Nur a/compat/tests/urls.py b/compat/tests/urls.py +--- a/compat/tests/urls.py 2020-03-06 15:32:07.548482597 +0100 ++++ b/compat/tests/urls.py 2020-03-06 15:34:25.962377799 +0100 +@@ -2,5 +2,5 @@ + from django.contrib.auth import views + + urlpatterns = [ +- url(r'^accounts/logout/$', views.logout, name='logout'), ++ url(r'^accounts/logout/$', views.auth_logout, name='logout'), + ] |