GNU bug report logs - #70858
[PATCH 00/32] python-team: Remove native inputs

Previous Next

Package: guix-patches;

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

Date: Fri, 10 May 2024 07:50:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: 70858 <at> debbugs.gnu.org
Cc: Nicolas Graves <ngraves <at> ngraves.fr>
Subject: [bug#70858] [PATCH v4 40/52] build-system/pyproject: Add option #:use-pytest-plugin?
Date: Wed, 26 Feb 2025 04:10:48 +0100
In the very rare cases where our plugin actually breaks a test, adding
a flag is more convenient than replacing the phase.

* guix/build-system/pyproject.scm (pyproject-build): Add option
use-pytest-plugin?

* guix/build/pyproject-build-system.scm (check): Add and use option
use-pytest-plugin?

* gnu/packages/check.scm (python-coverage,
python-pytest-mypy)[arguments]{use-pytest-plugin}: Set to #f to fix
tests.

* gnu/packages/python-check.scm (python-pytest-flake8)[arguments]:
Likewise.
---
 gnu/packages/check.scm                | 6 +++++-
 gnu/packages/python-check.scm         | 1 +
 guix/build-system/pyproject.scm       | 2 ++
 guix/build/pyproject-build-system.scm | 9 ++++++---
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index c0b6f3e0af..c817a18631 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -2497,6 +2497,8 @@ (define-public python-coverage
          "--deselect=tests/test_filereporter.py::FileReporterTest::test_zipfile"
          ;; XXX: Checking coverage for too much files, not only the target one.
          "--deselect=tests/test_oddball.py::DoctestTest::test_doctest")
+      ;; This is one of the rare cases where our plugin causes a test to fail.
+      #:use-pytest-plugin? #f
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'patch-pyproject
@@ -2994,7 +2996,9 @@ (define-public python-pytest-mypy
     (build-system pyproject-build-system)
     (arguments
      (list
-      #:test-flags #~(list "--numprocesses" "auto")))
+      #:use-pytest-plugin? #f
+      #:test-flags #~(list "--numprocesses"
+                           (number->string (parallel-job-count)))))
     (native-inputs
      (list python-pexpect
            python-pytest-xdist
diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index 7a8ff17175..7cedb111ad 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -1704,6 +1704,7 @@ (define-public python-pytest-flake8
         (base32
          "1rhz7mxcg7x9dbabfcjai3zxikfgw7az07m4ddf92bg35ib3byw8"))))
     (build-system pyproject-build-system)
+    (arguments (list #:use-pytest-plugin? #f))
     (native-inputs
      (list python-pytest
            python-setuptools
diff --git a/guix/build-system/pyproject.scm b/guix/build-system/pyproject.scm
index bdf8f440ac..1cd38ce349 100644
--- a/guix/build-system/pyproject.scm
+++ b/guix/build-system/pyproject.scm
@@ -93,6 +93,7 @@ (define private-keywords
 (define* (pyproject-build name inputs
                           #:key source
                           (tests? #t)
+                          (use-pytest-plugin? #t)
                           (configure-flags ''(@))
                           (backend-path #f)
                           (build-backend #f)
@@ -125,6 +126,7 @@ (define build
                  #:test-backend #$test-backend
                  #:test-flags #$test-flags
                  #:tests? #$tests?
+                 #:use-pytest-plugin? #$use-pytest-plugin?
                  #:phases #$(if (pair? phases)
                                 (sexp->gexp phases)
                                 phases)
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index 2df9f2f479..a96ec05ad6 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -231,7 +231,8 @@ (define-syntax-rule (with-guix-pytest-plugin inputs exp ...)
   "Evaluate EXP in a context where the Guix pytest plugin is added."
   (call-with-guix-pytest-plugin inputs (lambda () exp ...)))
 
-(define* (check #:key inputs tests? test-backend test-flags #:allow-other-keys)
+(define* (check #:key inputs tests? test-backend test-flags use-pytest-plugin?
+                #:allow-other-keys)
   "Run the test suite of a given Python package."
   (if tests?
       ;; Unfortunately with PEP 517 there is no common method to specify test
@@ -254,8 +255,10 @@ (define* (check #:key inputs tests? test-backend test-flags #:allow-other-keys)
         (format #t "Using ~a~%" use-test-backend)
         (match use-test-backend
           ('pytest
-           (with-guix-pytest-plugin inputs
-             (apply invoke pytest "-vv" test-flags)))
+           (if use-pytest-plugin?
+               (with-guix-pytest-plugin inputs
+                 (apply invoke pytest "-vv" test-flags))
+               (apply invoke pytest "-vv" test-flags)))
           ('nose
            (apply invoke nosetests "-v" test-flags))
           ('nose2
-- 
2.48.1





This bug report was last modified 67 days ago.

Previous Next


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