gnu: python-attrs: Conditionally execute tests.
authorRicardo Wurmus <rekado@elephly.net>
Mon, 7 Jun 2021 08:49:43 +0000 (10:49 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Mon, 7 Jun 2021 08:53:16 +0000 (10:53 +0200)
* gnu/packages/python-xyz.scm (python-attrs)[arguments]: Wrap "check" phase in
conditional expression.

gnu/packages/python-xyz.scm

index 6a6d7f4..e3f5295 100644 (file)
@@ -16991,18 +16991,20 @@ and bit flag values.")
                   (ice-9 ftw)
                   (srfi srfi-1)
                   (srfi srfi-26))
-       #:phases (modify-phases %standard-phases
-                  (replace 'check
-                    (lambda _
-                      (let ((cwd (getcwd)))
-                        (setenv "PYTHONPATH"
-                                (string-append
-                                 cwd "/build/"
-                                 (find (cut string-prefix? "lib" <>)
-                                       (scandir (string-append cwd "/build")))
-                                 ":"
-                                 (getenv "PYTHONPATH")))
-                        (invoke "python" "-m" "pytest")))))))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (let ((cwd (getcwd)))
+                 (setenv "PYTHONPATH"
+                         (string-append
+                          cwd "/build/"
+                          (find (cut string-prefix? "lib" <>)
+                                (scandir (string-append cwd "/build")))
+                          ":"
+                          (getenv "PYTHONPATH")))
+                 (invoke "python" "-m" "pytest"))))))))
     (native-inputs
      `(("python-coverage" ,python-coverage)
        ("python-hypothesis" ,python-hypothesis)