Subject: [PATCH 7/9] gnu: Add python-nox.

From: Nicolas Graves <[email-masked]>
Date: Wed, 10 Aug 2022 00:43:31 +0200

* gnu/packages/python-check.scm (python-nox): New variable.
---
 gnu/packages/python-check.scm | 51 +++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index af0e5be28b..20ab26facf 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -107,6 +107,57 @@ (define-public python-beartype
 written in pure Python.")
     (license license:expat)))
 
+(define-public python-nox
+  (package
+    (name "python-nox")
+    (version "2022.1.7")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "nox" version))
+              (sha256
+               (base32
+                "0zkxv7y5952kizri6bnac3gq1kah3b7d1f3lmcpxzfdhxf626xdk"))))
+    (build-system python-build-system)
+    (propagated-inputs (list python-argcomplete
+                             python-colorlog
+                             python-importlib-metadata
+                             python-packaging
+                             python-py
+                             python-typing-extensions
+                             python-virtualenv))
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; XXX: PEP 517 manual build/install procedures copied from
+          ;; python-isort.
+          (replace 'build
+            (lambda _
+              ;; ZIP does not support timestamps before 1980.
+              (setenv "SOURCE_DATE_EPOCH" "315532800")
+              (invoke "python" "-m" "build" "--wheel" "--no-isolation" ".")))
+          (replace 'install
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((whl (car (find-files "dist" "\\.whl$"))))
+                (invoke "pip" "--no-cache-dir" "--no-input"
+                        "install" "--no-deps" "--prefix" #$output whl))))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "pytest" "-vv" "tests")))))))
+    (native-inputs
+     (list python-pypa-build
+           python-pytest
+           python-jinja2
+           python-tox))
+    (home-page "https://nox.thea.codes")
+    (synopsis "Flexible python test automation")
+    (description
+     "This package provides @code{nox}, a command-line tool that automates
+testing in multiple Python environments, similar to @code{tox}. Unlike
+@code{tox}, @code{nox} uses a standard Python file for configuration.")
+    (license license:asl2.0)))
+
 (define-public python-pytest-click
   (package
     (name "python-pytest-click")
-- 
2.37.1