guix-commits
[Top][All Lists]
Advanced

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

01/06: gnu: Add python-pyfakefs and python2-pyfakefs.


From: guix-commits
Subject: 01/06: gnu: Add python-pyfakefs and python2-pyfakefs.
Date: Thu, 25 Apr 2019 00:14:08 -0400 (EDT)

marusich pushed a commit to branch master
in repository guix.

commit 968e86bd930936d9f9ed0db299164018882cd5c1
Author: Chris Marusich <address@hidden>
Date:   Thu Apr 18 00:40:21 2019 -0700

    gnu: Add python-pyfakefs and python2-pyfakefs.
    
    * gnu/packages/patches/python-pyfakefs-remove-bad-test.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Add the patch.
    * gnu/packages/check.scm (python-pyfakefs, python2-pyfakefs): New
      variables.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/check.scm                             | 50 ++++++++++++++++++++++
 .../patches/python-pyfakefs-remove-bad-test.patch  | 23 ++++++++++
 3 files changed, 74 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index 82a74c7..18427de 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1203,6 +1203,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/python2-larch-coverage-4.0a6-compatibility.patch \
   %D%/packages/patches/python-configobj-setuptools.patch       \
   %D%/packages/patches/python-faker-fix-build-32bit.patch      \
+  %D%/packages/patches/python-pyfakefs-remove-bad-test.patch   \
   %D%/packages/patches/python-flint-includes.patch             \
   %D%/packages/patches/python-mox3-python3.6-compat.patch      \
   %D%/packages/patches/python-testtools.patch                  \
diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index a38abf0..0be1102 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -29,6 +29,7 @@
 ;;; Copyright © 2017, 2018 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2018 Fis Trivial <address@hidden>
 ;;; Copyright © 2019 Pierre Langlois <address@hidden>
+;;; Copyright © 2019 Chris Marusich <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2262,3 +2263,52 @@ record the properties and behaviour of particular 
devices, and to run a
 program or test suite under a test bed with the previously recorded devices
 loaded.")
     (license license:lgpl2.1+)))
+
+(define-public python-pyfakefs
+  (package
+    (name "python-pyfakefs")
+    (version "3.5.8")
+    (source (origin
+              (method url-fetch)
+              ;; We use the PyPI URL because there is no proper release
+              ;; available from GitHub.  The GitHub project only provides
+              ;; autogenerated tarballs, which are known to change in place.
+              (uri (pypi-uri "pyfakefs" version))
+              (sha256
+               (base32
+                "0qb9jp0bqhc0dv0rn805fv99029fvx135f3bvka6scfkcl6jgllc"))
+              (patches (search-patches
+                        "python-pyfakefs-remove-bad-test.patch"))
+              (file-name (string-append name "-" version ".tar.gz"))))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; The default test suite does not run these extra tests.
+         (add-after 'check 'check-pytest-plugin
+           (lambda _
+             (invoke
+              "python" "-m" "pytest"
+              "pyfakefs/pytest_tests/pytest_plugin_test.py")
+             #t)))))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
+    (build-system python-build-system)
+    ;; Guix lint doesn't like that this is a permanent redirect to the GitHub
+    ;; page, but the pyfakefs documentation asks us to use this specific URL
+    ;; when linking to the project.  Honor their request.
+    (home-page "http://pyfakefs.org/";)
+    ;; TRANSLATORS: In the synopsis, "Mock" is a verb.
+    (synopsis "Mock file system interactions in tests")
+    (description
+     "This package provides a Python library intended for use in automated
+tests.  One difficulty when testing software is that the code under test might
+need to read or write to files in the local file system.  If the file system
+is not set up in just the right way, it might cause a spurious error during
+the test.  The pyfakefs library provides a solution to problems like this by
+mocking file system interactions.  In other words, it arranges for the code
+under test to interact with a fake file system instead of the real file
+system.  The code under test requires no modification to work with pyfakefs.")
+    (license license:asl2.0)))
+
+(define-public python2-pyfakefs
+  (package-with-python2 python-pyfakefs))
diff --git a/gnu/packages/patches/python-pyfakefs-remove-bad-test.patch 
b/gnu/packages/patches/python-pyfakefs-remove-bad-test.patch
new file mode 100644
index 0000000..a9488bb
--- /dev/null
+++ b/gnu/packages/patches/python-pyfakefs-remove-bad-test.patch
@@ -0,0 +1,23 @@
+This test incorrectly assumes that the root user is always available.
+However, in the build environment, the root user is not available.
+Note that because the original file distributed in the release on PyPi
+has lines ending in CRLF, those are retained in the diff below.
+
+--- a/pyfakefs/tests/fake_filesystem_test.py   1969-12-31 16:00:00.000000000 
-0800
++++ b/pyfakefs/tests/fake_filesystem_test.py   1969-12-31 16:00:00.000000000 
-0800
+@@ -1021,15 +1021,6 @@
+             self.assertEqual(self.path.expanduser('~'),
+                              self.os.environ['HOME'].replace('/', '!'))
+ 
+-    @unittest.skipIf(TestCase.is_windows or TestCase.is_cygwin,
+-                     'only tested on unix systems')
+-    def test_expand_root(self):
+-        if sys.platform == 'darwin':
+-            roothome = '!var!root'
+-        else:
+-            roothome = '!root'
+-        self.assertEqual(self.path.expanduser('~root'), roothome)
+-
+     def test_getsize_path_nonexistent(self):
+         file_path = 'foo!bar!baz'
+         self.assertRaises(os.error, self.path.getsize, file_path)



reply via email to

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