Subject: bug#26554: closed (Re: bug#26554: [PATCH] Enable tests for package fabric)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 18 Apr 2017 17:35:02 +0000

Your bug report

#26554: [PATCH] Enable tests for package fabric

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
26554: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26554
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#26554: [PATCH] Enable tests for package fabric
From: Marius Bakke <[email-masked]>
To: Ben Sturmfels <[email-masked]>, [email-masked]
Date: Tue, 18 Apr 2017 19:34:32 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Ben Sturmfels <[email-masked]> writes:

> 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`.

Thanks for this! I changed the commit message of the second patch to
match our usual GNU ChangeLog style. Pushed!

Subject: [PATCH] Enable tests for package fabric
From: Ben Sturmfels <[email-masked]>
To: [email-masked]
Date: Wed, 19 Apr 2017 02:35:59 +1000
List-Id: <debbugs-submit.debbugs.gnu.org>

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 <[email-masked]>
Date: Wed, 19 Apr 2017 02:16:18 +1000
Subject: [PATCH 1/2] gnu: Add python-fudge.
To: [email-masked]

* 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 <[email-masked]>
 ;;; Copyright © 2017 Frederick M. Muriithi <[email-masked]>
 ;;; Copyright © 2017 humanitiesNerd <[email-masked]>
+;;; Copyright © 2017 Ben Sturmfels <[email-masked]>
 ;;;
 ;;; 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 <[email-masked]>
Date: Wed, 19 Apr 2017 02:24:57 +1000
Subject: [PATCH 2/2] gnu: fabric: Enable tests.
To: [email-masked]

* 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 <[email-masked]>
 ;;; Copyright © 2016 Peter Feigl <[email-masked]>
 ;;; Copyright © 2016 John J. Foerch <[email-masked]>
-;;; Coypright © 2016, 2017 ng0 <[email-masked]>
-;;; Coypright © 2016 Tobias Geerinckx-Rice <[email-masked]>
-;;; Coypright © 2016 John Darrington <[email-masked]>
-;;; Coypright © 2017 Ben Sturmfels <[email-masked]>
+;;; Copyright © 2016, 2017 ng0 <[email-masked]>
+;;; Copyright © 2016 Tobias Geerinckx-Rice <[email-masked]>
+;;; Copyright © 2016 John Darrington <[email-masked]>
+;;; Copyright © 2017 Ben Sturmfels <[email-masked]>
 ;;;
 ;;; 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