diff --git a/pkgs/development/python-modules/dj-rest-auth/default.nix b/pkgs/development/python-modules/dj-rest-auth/default.nix index 7cabff4b15e1..dffa779db8b7 100644 --- a/pkgs/development/python-modules/dj-rest-auth/default.nix +++ b/pkgs/development/python-modules/dj-rest-auth/default.nix @@ -11,6 +11,8 @@ responses, setuptools, unittest-xml-reporting, + pytestCheckHook, + pytest-django, }: buildPythonPackage rec { @@ -32,6 +34,13 @@ buildPythonPackage rec { url = "https://github.com/iMerica/dj-rest-auth/commit/cc5587e4e3f327697709f3f0d491650bff5464e7.diff"; hash = "sha256-2LahibxuNECAfjqsbNs2ezaWt1VH0ZBNwSNWCZwIe8I="; }) + # Add compatibility with django-allauth v65.4 + # See https://github.com/iMerica/dj-rest-auth/pull/681 + (fetchpatch { + name = "django-allauth_65.4_compatibility.patch"; + url = "https://github.com/iMerica/dj-rest-auth/commit/59b8cab7e2f4e3f2fdc11ab3b027a32cad45deef.patch"; + hash = "sha256-CH85vB3EOQvFxx+ZP2LYI4LEvaZ+ccLdXZGuAvEfStc="; + }) ]; postPatch = '' @@ -55,25 +64,36 @@ buildPythonPackage rec { unittest-xml-reporting ] ++ optional-dependencies.with_social; + checkInputs = [ + pytestCheckHook + pytest-django + ]; + + env.DJANGO_SETTINGS_MODULE = "dj_rest_auth.tests.settings"; + preCheck = '' - # Test connects to graph.facebook.com - substituteInPlace dj_rest_auth/tests/test_serializers.py \ - --replace-fail "def test_http_error" "def dont_test_http_error" + # Make tests module available for the checkPhase + export PYTHONPATH=$out/${python.sitePackages}/dj_rest_auth:$PYTHONPATH ''; - checkPhase = '' - runHook preCheck - ${python.interpreter} runtests.py - runHook postCheck - ''; + disabledTests = [ + # Test connects to graph.facebook.com + "TestSocialLoginSerializer" + ]; + + disabledTestPaths = [ + # Test fails with > django-allauth 65.4 + # See: https://github.com/iMerica/dj-rest-auth/pull/681#issuecomment-3034953311 + "dj_rest_auth/tests/test_social.py" + ]; pythonImportsCheck = [ "dj_rest_auth" ]; - meta = with lib; { + meta = { description = "Authentication for Django Rest Framework"; homepage = "https://github.com/iMerica/dj-rest-auth"; changelog = "https://github.com/iMerica/dj-rest-auth/releases/tag/${version}"; - license = licenses.mit; - maintainers = [ ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ onny ]; }; }