GNU bug report logs - #26554
[PATCH] Enable tests for package fabric

Previous Next

Package: guix-patches;

Reported by: Ben Sturmfels <ben <at> sturm.com.au>

Date: Tue, 18 Apr 2017 16:37:01 UTC

Severity: normal

Tags: patch

Done: Marius Bakke <mbakke <at> fastmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ben Sturmfels <ben <at> sturm.com.au>
To: 26554 <at> debbugs.gnu.org
Subject: bug#26554: [PATCH] Enable tests for package fabric
Date: Wed, 19 Apr 2017 02:35:59 +1000
[Message part 1 (text/plain, inline)]
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
[0001-gnu-Add-python-fudge.patch (text/x-patch, inline)]
From 5cdd66a7b064108094d871e9af732739c1ad598e Mon Sep 17 00:00:00 2001
From: Ben Sturmfels <ben <at> sturm.com.au>
Date: Wed, 19 Apr 2017 02:16:18 +1000
Subject: [PATCH 1/2] gnu: Add python-fudge.
To: guix-patches <at> gnu.org

* 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 <carlo <at> zancanaro.id.au>
 ;;; Copyright © 2017 Frederick M. Muriithi <fredmanglis <at> gmail.com>
 ;;; Copyright © 2017 humanitiesNerd <catonano <at> gmail.com>
+;;; Copyright © 2017 Ben Sturmfels <ben <at> sturm.com.au>
 ;;;
 ;;; 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

[0002-gnu-fabric-Enable-tests.patch (text/x-patch, inline)]
From 10ae75888ee088776617568434af51b59ad8e005 Mon Sep 17 00:00:00 2001
From: Ben Sturmfels <ben <at> sturm.com.au>
Date: Wed, 19 Apr 2017 02:24:57 +1000
Subject: [PATCH 2/2] gnu: fabric: Enable tests.
To: guix-patches <at> gnu.org

* 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 <efraim <at> flashner.co.il>
 ;;; Copyright © 2016 Peter Feigl <peter.feigl <at> nexoid.at>
 ;;; Copyright © 2016 John J. Foerch <jjfoerch <at> earthlink.net>
-;;; Coypright © 2016, 2017 ng0 <contact.ng0 <at> cryptolab.net>
-;;; Coypright © 2016 Tobias Geerinckx-Rice <me <at> tobias.gr>
-;;; Coypright © 2016 John Darrington <jmd <at> gnu.org>
-;;; Coypright © 2017 Ben Sturmfels <ben <at> sturm.com.au>
+;;; Copyright © 2016, 2017 ng0 <contact.ng0 <at> cryptolab.net>
+;;; Copyright © 2016 Tobias Geerinckx-Rice <me <at> tobias.gr>
+;;; Copyright © 2016 John Darrington <jmd <at> gnu.org>
+;;; Copyright © 2017 Ben Sturmfels <ben <at> sturm.com.au>
 ;;;
 ;;; 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


This bug report was last modified 8 years and 93 days ago.

Previous Next


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