unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26554: [PATCH] Enable tests for package fabric
@ 2017-04-18 16:35 Ben Sturmfels
       [not found] ` <handler.26554.B.149253340111331.ack@debbugs.gnu.org>
  2017-04-18 17:34 ` bug#26554: [PATCH] Enable tests for package fabric Marius Bakke
  0 siblings, 2 replies; 3+ messages in thread
From: Ben Sturmfels @ 2017-04-18 16:35 UTC (permalink / raw)
  To: 26554

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

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

[-- Attachment #2: 0001-gnu-Add-python-fudge.patch --]
[-- Type: text/x-patch, Size: 2380 bytes --]

From 5cdd66a7b064108094d871e9af732739c1ad598e Mon Sep 17 00:00:00 2001
From: Ben Sturmfels <ben@sturm.com.au>
Date: Wed, 19 Apr 2017 02:16:18 +1000
Subject: [PATCH 1/2] gnu: Add python-fudge.
To: guix-patches@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@zancanaro.id.au>
 ;;; Copyright © 2017 Frederick M. Muriithi <fredmanglis@gmail.com>
 ;;; Copyright © 2017 humanitiesNerd <catonano@gmail.com>
+;;; Copyright © 2017 Ben Sturmfels <ben@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


[-- Attachment #3: 0002-gnu-fabric-Enable-tests.patch --]
[-- Type: text/x-patch, Size: 3346 bytes --]

From 10ae75888ee088776617568434af51b59ad8e005 Mon Sep 17 00:00:00 2001
From: Ben Sturmfels <ben@sturm.com.au>
Date: Wed, 19 Apr 2017 02:24:57 +1000
Subject: [PATCH 2/2] gnu: fabric: Enable tests.
To: guix-patches@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@flashner.co.il>
 ;;; Copyright © 2016 Peter Feigl <peter.feigl@nexoid.at>
 ;;; Copyright © 2016 John J. Foerch <jjfoerch@earthlink.net>
-;;; Coypright © 2016, 2017 ng0 <contact.ng0@cryptolab.net>
-;;; Coypright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Coypright © 2016 John Darrington <jmd@gnu.org>
-;;; Coypright © 2017 Ben Sturmfels <ben@sturm.com.au>
+;;; Copyright © 2016, 2017 ng0 <contact.ng0@cryptolab.net>
+;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016 John Darrington <jmd@gnu.org>
+;;; Copyright © 2017 Ben Sturmfels <ben@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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#26554: Acknowledgement ([PATCH] Enable tests for package fabric)
       [not found] ` <handler.26554.B.149253340111331.ack@debbugs.gnu.org>
@ 2017-04-18 17:09   ` Ben Sturmfels
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Sturmfels @ 2017-04-18 17:09 UTC (permalink / raw)
  To: 26554

[-- Attachment #1: Type: text/plain, Size: 89 bytes --]

I've now also submitted the changes in "fabric-tests.patch" to the
upstream project.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#26554: [PATCH] Enable tests for package fabric
  2017-04-18 16:35 bug#26554: [PATCH] Enable tests for package fabric Ben Sturmfels
       [not found] ` <handler.26554.B.149253340111331.ack@debbugs.gnu.org>
@ 2017-04-18 17:34 ` Marius Bakke
  1 sibling, 0 replies; 3+ messages in thread
From: Marius Bakke @ 2017-04-18 17:34 UTC (permalink / raw)
  To: Ben Sturmfels, 26554-done

[-- Attachment #1: Type: text/plain, Size: 453 bytes --]

Ben Sturmfels <ben@sturm.com.au> 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!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-18 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-18 16:35 bug#26554: [PATCH] Enable tests for package fabric Ben Sturmfels
     [not found] ` <handler.26554.B.149253340111331.ack@debbugs.gnu.org>
2017-04-18 17:09   ` bug#26554: Acknowledgement ([PATCH] Enable tests for package fabric) Ben Sturmfels
2017-04-18 17:34 ` bug#26554: [PATCH] Enable tests for package fabric Marius Bakke

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).