guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: gnu: python-pytest-virtualenv: Enable tests.


From: guix-commits
Subject: 02/02: gnu: python-pytest-virtualenv: Enable tests.
Date: Thu, 12 Sep 2019 11:11:40 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit e2fb29b792cb9cf2416c6292ece56c09a89bdcc9
Author: Maxim Cournoyer <address@hidden>
Date:   Wed Sep 11 23:22:10 2019 +0900

    gnu: python-pytest-virtualenv: Enable tests.
    
    * gnu/packages/python-check.scm (python-pytest-virtualenv)
    [phases]{patch-virtualenv-executable}: New phase.
    [propagated-inputs]: Move python-virtualenv from here...
    [inputs]: ...to here.
---
 gnu/packages/python-check.scm | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index 676dae5..b8aaef9 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2019 Ricardo Wurmus <address@hidden>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <address@hidden>
 ;;; Copyright © 2019 Efraim Flashner <address@hidden>
+;;; Copyright © 2019 Maxim Cournoyer <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -226,11 +227,27 @@ testing framework.")
         (base32
          "03w2zz3crblj1p6i8nq17946hbn3zqp9z7cfnifw47hi4a4fww12"))))
     (build-system python-build-system)
-    (arguments '(#:tests? #f)) ; one test fails; can't find virtualenv
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; Reference the virtualenv executable directly, to avoid the need
+         ;; for PYTHONPATH, which gets cleared when instantiating a new
+         ;; virtualenv with pytest-virtualenv.
+         (add-after 'unpack 'patch-virtualenv-executable
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((virtualenv (assoc-ref inputs "python-virtualenv"))
+                    (virtualenv-bin (string-append virtualenv
+                                                   "/bin/virtualenv")))
+               (substitute* "pytest_virtualenv.py"
+                 (("^DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE.*$")
+                  (format #f "DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = '~a'"
+                          virtualenv-bin)))
+               #t))))))
     (propagated-inputs
-     `(("python-virtualenv" ,python-virtualenv)
-       ("python-pytest-shutil" ,python-pytest-shutil)
+     `(("python-pytest-shutil" ,python-pytest-shutil)
        ("python-pytest-fixture-config" ,python-pytest-fixture-config)))
+    (inputs
+     `(("python-virtualenv" ,python-virtualenv)))
     (native-inputs
      `(("python-mock" ,python-mock)
        ("python-pytest" ,python-pytest)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]