guix-patches
[Top][All Lists]
Advanced

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

bug#26554: [PATCH] Enable tests for package fabric


From: Ben Sturmfels
Subject: bug#26554: [PATCH] Enable tests for package fabric
Date: Wed, 19 Apr 2017 02:35:59 +1000
User-agent: mu4e 0.9.18; emacs 25.1.1

Hi Folks,

The attached patches add the missing "python2-nose" test requirement for
the "fabric" package and enable fabric's tests.

I had to patch fabric's tests to avoid using the `fab` executable that
is created dynamically during installation; instead using `python -m
fabric`.

Regards,
Ben

--
Ben Sturmfels

Sturm - Software Engineering
www.sturm.com.au
(03) 9024 2467
>From 5cdd66a7b064108094d871e9af732739c1ad598e Mon Sep 17 00:00:00 2001
From: Ben Sturmfels <address@hidden>
Date: Wed, 19 Apr 2017 02:16:18 +1000
Subject: [PATCH 1/2] gnu: Add python-fudge.
To: address@hidden

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

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 8cd433a93..aa014db36 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -37,6 +37,7 @@
 ;;; Copyright © 2017 Carlo Zancanaro <address@hidden>
 ;;; Copyright © 2017 Frederick M. Muriithi <address@hidden>
 ;;; Copyright © 2017 humanitiesNerd <address@hidden>
+;;; Copyright © 2017 Ben Sturmfels <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -13965,3 +13966,36 @@ recognize TestCases.")
        (sha256
         (base32
          "17jlkdpqw22z1nyml5ybslilqkzmnk0dxxjml8bfghav1l5hbwd2"))))))
+
+(define-public python-fudge
+  (package
+    (name "python-fudge")
+    ;; 0.9.6 is the latest version suitable for testing the "fabric" Python 2
+    ;; package, which is currently the only use of this package.
+    (version "0.9.6")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "fudge" version))
+       (sha256
+        (base32
+         "185ia3vr3qk4f2s1a9hdxb8ci4qc0x0xidrad96pywg8j930qs9l"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f))     ;XXX: Tests require the NoseJS Python package.
+    (home-page "https://github.com/fudge-py/fudge";)
+    (synopsis "Replace real objects with fakes/mocks/stubs while testing")
+    (description
+     "Fudge is a Python module for using fake objects (mocks and stubs) to
+test real ones.
+
+In readable Python code, you declare the methods available on your fake object
+and how they should be called.  Then you inject that into your application and
+start testing.  This declarative approach means you don’t have to record and
+playback actions and you don’t have to inspect your fakes after running code.
+If the fake object was used incorrectly then you’ll see an informative
+exception message with a traceback that points to the culprit.")
+    (license license:expat)))
+
+(define-public python2-fudge
+  (package-with-python2 python-fudge))
-- 
2.12.2

>From 10ae75888ee088776617568434af51b59ad8e005 Mon Sep 17 00:00:00 2001
From: Ben Sturmfels <address@hidden>
Date: Wed, 19 Apr 2017 02:24:57 +1000
Subject: [PATCH 2/2] gnu: fabric: Enable tests.
To: address@hidden

* gnu/packages/admin.scm (fabric): Specify test dependencies.
---
 gnu/packages/admin.scm                  | 18 +++++++++++-------
 gnu/packages/patches/fabric-tests.patch | 15 +++++++++++++++
 2 files changed, 26 insertions(+), 7 deletions(-)
 create mode 100644 gnu/packages/patches/fabric-tests.patch

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 4daaddcfe..8f4a4cd41 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -12,10 +12,10 @@
 ;;; Copyright © 2016, 2017 Efraim Flashner <address@hidden>
 ;;; Copyright © 2016 Peter Feigl <address@hidden>
 ;;; Copyright © 2016 John J. Foerch <address@hidden>
-;;; Coypright © 2016, 2017 ng0 <address@hidden>
-;;; Coypright © 2016 Tobias Geerinckx-Rice <address@hidden>
-;;; Coypright © 2016 John Darrington <address@hidden>
-;;; Coypright © 2017 Ben Sturmfels <address@hidden>
+;;; Copyright © 2016, 2017 ng0 <address@hidden>
+;;; Copyright © 2016 Tobias Geerinckx-Rice <address@hidden>
+;;; Copyright © 2016 John Darrington <address@hidden>
+;;; Copyright © 2017 Ben Sturmfels <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2060,11 +2060,15 @@ Intel DRM Driver.")
        (uri (pypi-uri "Fabric" version))
        (sha256
         (base32
-         "1z17hw0yiqp1blq217zxkg2jzkv8qd79saqhscgsw14mwlcqpwd0"))))
+         "1z17hw0yiqp1blq217zxkg2jzkv8qd79saqhscgsw14mwlcqpwd0"))
+       (patches (search-patches "fabric-tests.patch"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f     ;XXX: Tests attempt to download Python "fudge" package.
-       #:python ,python-2))                       ;Python 2 only
+     `(#:python ,python-2))                       ;Python 2 only
+    (native-inputs
+     `(("python2-fudge" ,python2-fudge) ; Requires < 1.0
+       ("python2-jinja2" ,python2-jinja2) ; Requires < 3.0
+       ("python2-nose" ,python2-nose))) ; Requires < 2.0
     (propagated-inputs
      ;; Required upgrading python-paramiko 1.17.4 to fix an incompatibility
      ;; between python-paramiko and newer python-pycrypto. Without this, the
diff --git a/gnu/packages/patches/fabric-tests.patch 
b/gnu/packages/patches/fabric-tests.patch
new file mode 100644
index 000000000..4a0ca9f8f
--- /dev/null
+++ b/gnu/packages/patches/fabric-tests.patch
@@ -0,0 +1,15 @@
+The `fab` excecutable doesn't exist during the test phase as it is created
+dynamically during installation. Refer to the equivalent Python module
+directly.
+
+--- a/tests/test_utils.py
++++ b/tests/test_utils.py
+@@ -93,7 +93,7 @@
+     # perform when they are allowed to bubble all the way to the top. So, we
+     # invoke a subprocess and look at its stderr instead.
+     with quiet():
+-        result = local("fab -f tests/support/aborts.py kaboom", capture=True)
++        result = local("python -m fabric -f tests/support/aborts.py kaboom", 
capture=True)
+     # When error in #1318 is present, this has an extra "It burns!" at end of
+     # stderr string.
+     eq_(result.stderr, "Fatal error: It burns!\n\nAborting.")
\ No newline at end of file
-- 
2.12.2


reply via email to

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