diff mbox

[04/16] gnu: Add python-pytest-mock.

Message ID 20160911185857.2123-5-efraim@flashner.co.il
State New
Headers show

Commit Message

Efraim Flashner Sept. 11, 2016, 6:58 p.m. UTC
* gnu/packages/python.scm (python-pytest-mock): New variable.
---
 gnu/packages/python.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

Comments

David Craven Sept. 11, 2016, 7:42 p.m. UTC | #1
> +      (inputs
> +       `(("python2-mock" ,python2-mock)
> +         ,@(package-inputs base))))))

Is python2-mock really an input and not a native-input?
Efraim Flashner Sept. 12, 2016, 5:34 a.m. UTC | #2
On Sun, Sep 11, 2016 at 09:42:34PM +0200, David Craven wrote:
> > +      (inputs
> > +       `(("python2-mock" ,python2-mock)
> > +         ,@(package-inputs base))))))
> 
> Is python2-mock really an input and not a native-input?

Actually, yes. I was a little suprised that the python3 version didn't
want it also. Since its one of the python test packages it actually
retains references to the other test packages.
diff mbox

Patch

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index a340604..0886c4f 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -1683,6 +1683,45 @@  supports coverage of subprocesses.")
 (define-public python2-pytest-runner
   (package-with-python2 python-pytest-runner))
 
+(define-public python-pytest-mock
+  (package
+    (name "python-pytest-mock")
+    (version "1.2")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "pytest-mock" version ".zip"))
+        (sha256
+         (base32
+          "03zxar5drzm7ksqyrwypjaza3cri6wqvpr6iam92djvg6znp32gp"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("unzip" ,unzip)))
+    (inputs
+     `(("python-py" ,python-py)
+       ("python-pytest" ,python-pytest)))
+    (home-page "https://github.com/pytest-dev/pytest-mock/")
+    (synopsis "Thin-wrapper around the mock package for easier use with py.test")
+    (description
+     "This plugin installs a @code{mocker} fixture which is a thin-wrapper
+around the patching API provided by the @code{mock} package, but with the
+benefit of not having to worry about undoing patches at the end of a test.
+The mocker fixture has the same API as @code{mock.patch}, supporting the
+same arguments.")
+    (properties `((python2-variant . ,(delay python2-pytest-mock))))
+    (license license:expat)))
+
+(define-public python2-pytest-mock
+  (let ((base (package-with-python2
+                (strip-python2-variant python-pytest-mock))))
+    (package (inherit base)
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base)))
+      (inputs
+       `(("python2-mock" ,python2-mock)
+         ,@(package-inputs base))))))
+
 (define-public python-pytest-xdist
   (package
     (name "python-pytest-xdist")