[PATCH] guix: pyproject-build-system: Add python test-backend.

  • Open
  • quality assurance status badge
Details
One participant
  • Nicolas Graves
Owner
unassigned
Submitted by
Nicolas Graves
Severity
normal
N
N
Nicolas Graves wrote on 20 Apr 16:11 +0200
(address . guix-patches@gnu.org)(address . ngraves@ngraves.fr)
20240420141444.30064-1-ngraves@ngraves.fr
* guix/build/pyproject-build-system(check): Add python test-backend.

This will help in cases where a simple `python -m module args` call has
to be made instead of fully replacing the 'check phase, e.g. unittest
or django. This is never enabled unless #:test-backend 'python is set,
so it doesn't break anything.

As an example, the following snippet...

(arguments
(list #:phases #~(modify-phases %standard-phases
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(invoke "python" "-m" "unittest"
"diff_match_patch.tests")))))))

...can be transformed like this:

(arguments
'(#:test-backend 'python
#:test-flags (list "-m" "unittest" "diff_match_patch.tests")))

Change-Id: I4919a3e01d64864e3c328609fbcce7df5b3dfe51
---
guix/build/pyproject-build-system.scm | 2 ++
1 file changed, 2 insertions(+)

Toggle diff (15 lines)
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index c69ccc9d64..295542f317 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -168,6 +168,8 @@ (define* (check #:key tests? test-backend test-flags #:allow-other-keys)
(if (null? test-flags)
'("test" "-v")
test-flags)))
+ ('python
+ (apply invoke "python" test-flags))
;; The developer should explicitly disable tests in this case.
(else (raise (condition (&test-system-not-found))))))
(format #t "test suite not run~%")))
--
2.41.0
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 70482@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 70482
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch