summary refs log tree commit diff
path: root/gnu/packages/django.scm
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2021-05-07 13:41:52 +0200
committerMarius Bakke <marius@gnu.org>2021-05-07 16:01:58 +0200
commita0365cf0073c550ef00baf462ce4875552867d36 (patch)
tree5dd7df8990bc69fe8b72b341736f407b28faaf93 /gnu/packages/django.scm
parentbb716e8d9d7982e92fbb624766f05b7398640bc5 (diff)
downloadguix-a0365cf0073c550ef00baf462ce4875552867d36.tar.gz
gnu: python-djangorestframework: Enable tests.
* gnu/packages/django.scm (python-djangorestframework)[source]: Change to
GIT-FETCH.
[arguments]: Remove #:tests?.  Add #:phases.
[native-inputs]: New field.
Diffstat (limited to 'gnu/packages/django.scm')
-rw-r--r--gnu/packages/django.scm28
1 files changed, 23 insertions, 5 deletions
diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm
index 5ec1c57005..df143dcab7 100644
--- a/gnu/packages/django.scm
+++ b/gnu/packages/django.scm
@@ -1028,15 +1028,33 @@ Django projects, which allows association of a number of tags with any
     (version "3.12.4")
     (source
      (origin
-       (method url-fetch)
-       (uri (pypi-uri "djangorestframework" version))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/encode/django-rest-framework")
+             (commit version)))
+       (file-name (git-file-name name version))
        (sha256
         (base32
-         "1wm7q3vp4226n6fhjnkjxg6pgh95p6ag238rg7l7dj6sind98izp"))))
+         "16n17dw35wqv47m8k8fixn0yywrvd6v4r573yr4nx6lbbiyi2cqn"))))
     (build-system python-build-system)
     (arguments
-     '(;; No included tests
-       #:tests? #f))
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             ;; Add a fix from the master branch for compatibility with Django
+             ;; 3.2: https://github.com/encode/django-rest-framework/pull/7911
+             ;; Remove for versions > 3.12.4.
+             (substitute* "tests/test_fields.py"
+               (("class MockTimezone:")
+                "class MockTimezone(pytz.BaseTzInfo):"))
+             (if tests?
+                 (invoke "python" "runtests.py" "--nolint")
+                 (format #t "test suite not run~%")))))))
+    (native-inputs
+     `(("python-django" ,python-django)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-django" ,python-pytest-django)))
     (home-page "https://www.django-rest-framework.org")
     (synopsis "Toolkit for building Web APIs with Django")
     (description