gnu: python-django: Support '--without-tests'.

* gnu/packages/django.scm (python-django)[arguments]: Test for TESTS? in the
'check' phase.
This commit is contained in:
Marius Bakke 2021-05-05 21:21:03 +02:00
parent 4ae8390ffc
commit e355222382
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA

View file

@ -6,7 +6,7 @@
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 Vijayalakshmi Vedantham <vijimay12@gmail.com> ;;; Copyright © 2018 Vijayalakshmi Vedantham <vijimay12@gmail.com>
;;; Copyright © 2019 Sam <smbaines8@gmail.com> ;;; Copyright © 2019 Sam <smbaines8@gmail.com>
;;; Copyright © 2020 Marius Bakke <marius@gnu.org> ;;; Copyright © 2020, 2021 Marius Bakke <marius@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -87,15 +87,17 @@ (define-public python-django
#t)) #t))
(replace 'check (replace 'check
(lambda _ (lambda* (#:key tests? #:allow-other-keys)
(with-directory-excursion "tests" (if tests?
(setenv "PYTHONPATH" (with-directory-excursion "tests"
(string-append "..:" (getenv "PYTHONPATH"))) (setenv "PYTHONPATH"
(invoke "python" "runtests.py" (string-append "..:" (getenv "PYTHONPATH")))
;; By default tests run in parallel, which may cause (invoke "python" "runtests.py"
;; various race conditions. Run sequentially for ;; By default tests run in parallel, which may cause
;; consistent results. ;; various race conditions. Run sequentially for
"--parallel=1"))))))) ;; consistent results.
"--parallel=1"))
(format #t "test suite not run~%")))))))
;; TODO: Install extras/django_bash_completion. ;; TODO: Install extras/django_bash_completion.
(native-inputs (native-inputs
`(("tzdata" ,tzdata-for-tests) `(("tzdata" ,tzdata-for-tests)