all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Graves via Guix-patches via <guix-patches@gnu.org>
To: 70482@debbugs.gnu.org
Cc: ngraves@ngraves.fr
Subject: [bug#70482] [PATCH] guix: pyproject-build-system: Add python test-backend.
Date: Sat, 20 Apr 2024 16:11:00 +0200	[thread overview]
Message-ID: <20240420141444.30064-1-ngraves@ngraves.fr> (raw)

* 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(+)

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





                 reply	other threads:[~2024-04-20 14:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240420141444.30064-1-ngraves@ngraves.fr \
    --to=guix-patches@gnu.org \
    --cc=70482@debbugs.gnu.org \
    --cc=ngraves@ngraves.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.