build-system/pyproject: Always run tests verbosely for supported backends.

* guix/build-system/pyproject.scm (pyproject-build): Default to '() instead of
 #false for TEST-FLAGS.
* guix/build/pyproject-build-system.scm (check): Unconditionally enable
verbose test flags.
* doc/guix.texi (Build Systems): Document this change.
* gnu/packages/fontutils.scm (python-glyphslib)[arguments]: Remove verbosity
from #:test-flags.
* gnu/packages/pdf.scm (python-pydyf, weasyprint)[arguments]: Likewise.
* gnu/packages/python-web.scm (python-openapi-spec-validator)[arguments]: Likewise.
* gnu/packages/python-xyz.scm (python-path, python-tempora)[arguments]: Likewise.
This commit is contained in:
Marius Bakke 2022-10-27 20:31:38 +02:00
parent 6ef998d54e
commit e944734ef9
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA
7 changed files with 17 additions and 15 deletions

View file

@ -9332,8 +9332,9 @@ to guess the appropriate backend based on @file{pyproject.toml}.
@code{#:test-backend} is added. It defaults to @code{#false} and will guess @code{#:test-backend} is added. It defaults to @code{#false} and will guess
an appropriate test backend based on what is available in package inputs. an appropriate test backend based on what is available in package inputs.
@item @item
@code{#:test-flags} is added. The default is @code{#false}, and varies based @code{#:test-flags} is added. The default is @code{'()}. These flags are
on the detected @code{#:test-backend}. passed as arguments to the test command. Note that flags for verbose output
is always enabled on supported backends.
@end itemize @end itemize
It is considered ``experimental'' in that the implementation details are It is considered ``experimental'' in that the implementation details are

View file

@ -598,8 +598,7 @@ (define-public python-glyphslib
(build-system pyproject-build-system) (build-system pyproject-build-system)
(arguments (arguments
(list (list
#:test-flags #~'("-vv" #:test-flags #~'(;; These fail because the test data has not yet been
;; These fail because the test data has not yet been
;; updated for newer FontTools: ;; updated for newer FontTools:
;; https://github.com/googlefonts/glyphsLib/issues/787 ;; https://github.com/googlefonts/glyphsLib/issues/787
;; Re-enable for versions > 6.0.7. ;; Re-enable for versions > 6.0.7.

View file

@ -739,7 +739,7 @@ (define-public python-pydyf
(build-system pyproject-build-system) (build-system pyproject-build-system)
(arguments (arguments
(list (list
#:test-flags #~'("-vv" "-c" "/dev/null"))) #:test-flags #~'("-c" "/dev/null")))
(propagated-inputs (list python-pillow)) (propagated-inputs (list python-pillow))
(native-inputs (native-inputs
(list ghostscript (list ghostscript
@ -1500,7 +1500,7 @@ (define-public weasyprint
(build-system pyproject-build-system) (build-system pyproject-build-system)
(arguments (arguments
(list (list
#:test-flags #~(list "-vv" "-c" "/dev/null" #:test-flags #~(list "-c" "/dev/null"
"-n" (number->string (parallel-job-count))) "-n" (number->string (parallel-job-count)))
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases

View file

@ -1648,7 +1648,7 @@ (define-public python-openapi-spec-validator
(list (list
;; The example tests attempt to fetch resources from the Internet ;; The example tests attempt to fetch resources from the Internet
;; (see: https://github.com/p1c2u/openapi-spec-validator/issues/151). ;; (see: https://github.com/p1c2u/openapi-spec-validator/issues/151).
#:test-flags #~'("-vv" "-k" "not Example and not Exampe") #:test-flags #~'("-k" "not Example and not Exampe")
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'remove-coverage-pytest-options (add-after 'unpack 'remove-coverage-pytest-options

View file

@ -12753,7 +12753,7 @@ (define-public python-path
((#:tests? _ #f) ((#:tests? _ #f)
(not (%current-target-system))) (not (%current-target-system)))
((#:test-flags flags #~'()) ((#:test-flags flags #~'())
#~(append (list "-vv" "-k" #~(append (list "-k"
(string-append (string-append
;; Do not test the myproject.toml build as it tries ;; Do not test the myproject.toml build as it tries
;; to pull dependencies from the Internet. ;; to pull dependencies from the Internet.
@ -21366,7 +21366,7 @@ (define-public python-tempora
(arguments (arguments
;; Do not test the myproject.toml build as it tries to pull ;; Do not test the myproject.toml build as it tries to pull
;; dependencies from the Internet. ;; dependencies from the Internet.
(list #:test-flags #~'("-vv" "-k" "not project"))) (list #:test-flags #~'("-k" "not project")))
(native-inputs (native-inputs
(list python-freezegun (list python-freezegun
python-pytest python-pytest

View file

@ -95,7 +95,7 @@ (define* (pyproject-build name inputs
(configure-flags ''()) (configure-flags ''())
(build-backend #f) (build-backend #f)
(test-backend #f) (test-backend #f)
(test-flags #f) (test-flags ''())
(phases '%standard-phases) (phases '%standard-phases)
(outputs '("out" "wheel")) (outputs '("out" "wheel"))
(search-paths '()) (search-paths '())

View file

@ -158,14 +158,16 @@ (define* (check #:key tests? test-backend test-flags #:allow-other-keys)
(format #t "Using ~a~%" use-test-backend) (format #t "Using ~a~%" use-test-backend)
(match use-test-backend (match use-test-backend
('pytest ('pytest
(apply invoke (cons pytest (or test-flags '("-vv"))))) (apply invoke pytest "-vv" test-flags))
('nose ('nose
(apply invoke (cons nosetests (or test-flags '("-v"))))) (apply invoke nosetests "-v" test-flags))
('nose2 ('nose2
(apply invoke (cons nose2 (or test-flags '("-v" "--pretty-assert"))))) (apply invoke nose2 "-v" "--pretty-assert" test-flags))
('setup.py ('setup.py
(apply invoke (append '("python" "setup.py") (apply invoke "python" "setup.py"
(or test-flags '("test" "-v"))))) (if (null? test-flags)
'("test" "-v")
test-flags)))
;; The developer should explicitly disable tests in this case. ;; The developer should explicitly disable tests in this case.
(else (raise (condition (&test-system-not-found)))))) (else (raise (condition (&test-system-not-found))))))
(format #t "test suite not run~%"))) (format #t "test suite not run~%")))