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.
This commit is contained in:
Marius Bakke 2021-05-07 13:41:52 +02:00
parent bb716e8d9d
commit a0365cf007
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA

View file

@ -1028,15 +1028,33 @@ (define-public python-djangorestframework
(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