GNU bug report logs - #70482
[PATCH] guix: pyproject-build-system: Add python test-backend.

Previous Next

Package: guix-patches;

Reported by: Nicolas Graves <ngraves <at> ngraves.fr>

Date: Sat, 20 Apr 2024 14:16:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 70482 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#70482; Package guix-patches. (Sat, 20 Apr 2024 14:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Graves <ngraves <at> ngraves.fr>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 20 Apr 2024 14:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: guix-patches <at> gnu.org
Cc: ngraves <at> ngraves.fr
Subject: [PATCH] guix: pyproject-build-system: Add python test-backend.
Date: Sat, 20 Apr 2024 16:11:00 +0200
* 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





Information forwarded to guix-patches <at> gnu.org:
bug#70482; Package guix-patches. (Thu, 17 Apr 2025 23:18:04 GMT) Full text and rfc822 format available.

Message #8 received at 70482 <at> debbugs.gnu.org (full text, mbox):

From: Sharlatan Hellseher <sharlatanus <at> gmail.com>
To: 70482 <at> debbugs.gnu.org
Cc: ngraves <at> ngraves.fr
Subject: [PATCH] guix: pyproject-build-system: Add python test-backend.
Date: Fri, 18 Apr 2025 00:17:21 +0100
[Message part 1 (text/plain, inline)]
Hi Nicolas,

While we are both on python-team train this changes are very nice to
have! Let's consider to include it in upcoming iteration after the
branch is soon merged (soon!).

I've got some ideas on this patch.

--8<---------------cut here---------------start------------->8---
#:test-backend 'python
--8<---------------cut here---------------end--------------->8---
It's a little bit confusing, how about to literally "unittest" and the
next part would become:

--8<---------------cut here---------------start------------->8---
+          ('unittest
+           (apply invoke "python" "-m" "unittest" test-flags))
+          ('custom
+           (apply invoke "python" test-flags)) ; some wild custom tests e.g. Django
--8<---------------cut here---------------end--------------->8---
and ... document it!

WDYT?

--
Oleg
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 15 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.