unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Chris Marusich <cmmarusich@gmail.com>
To: 35333@debbugs.gnu.org
Subject: [bug#35333] [PATCH 1/6] gnu: Add python-pyfakefs and python2-pyfakefs.
Date: Fri, 19 Apr 2019 18:41:13 -0700	[thread overview]
Message-ID: <8736mdxxl2.fsf@gmail.com> (raw)
In-Reply-To: <20190420010800.5741-2-cmmarusich@gmail.com> (Chris Marusich's message of "Fri, 19 Apr 2019 18:07:55 -0700")


[-- Attachment #1.1: Type: text/plain, Size: 937 bytes --]

Chris Marusich <cmmarusich@gmail.com> writes:

> +              ;; Guix lint doesn't like that this release is an autogenerated
> +              ;; archive, but it seems those are the only releases available.
> +              (uri (pypi-uri "pyfakefs" version))

This comment is stale.  I've updated it in the attached patch.

> diff --git a/gnu/packages/patches/python-pyfakefs-remove-bad-test.patch b/gnu/packages/patches/python-pyfakefs-remove-bad-test.patch
> [...]
> +Note that because the original file distributed in the release on PyPi
> +has lines ending in CRLF, those are retained in the diff below.

For some reason, the CRLFs became LFs in the patch email, so the build
fails.  That's curious, because the output of git-format-patch
definitely included them.

I've attached the updated patch to this email using Gnus instead of
git-send-email.  Hopefully it will retain the CRLFs this time.

-- 
Chris

[-- Attachment #1.2: 0001-gnu-Add-python-pyfakefs-and-python2-pyfakefs.patch --]
[-- Type: text/x-patch, Size: 5836 bytes --]

From f2091091a90fc25d21e0191df88cf10c6e9890dd Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarusich@gmail.com>
Date: Thu, 18 Apr 2019 00:40:21 -0700
Subject: [PATCH] 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 +++++++++++++++++++
 .../python-pyfakefs-remove-bad-test.patch     | 23 +++++++++
 3 files changed, 74 insertions(+)
 create mode 100644 gnu/packages/patches/python-pyfakefs-remove-bad-test.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 41924a7de5..3953e5b789 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1201,6 +1201,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 a38abf0b5b..0be1102683 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -29,6 +29,7 @@
 ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
 ;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2019 Chris Marusich <cmmarusich@gmail.com>
 ;;;
 ;;; 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 0000000000..a9488bbe43
--- /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)
-- 
2.20.1


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

  reply	other threads:[~2019-04-20  1:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-20  0:38 [bug#35333] [PATCH 0/6] Add Yubikey Manager and Its Dependencies Chris Marusich
2019-04-20  1:07 ` Chris Marusich
2019-04-20  1:07   ` [bug#35333] [PATCH 1/6] gnu: Add python-pyfakefs and python2-pyfakefs Chris Marusich
2019-04-20  1:41     ` Chris Marusich [this message]
2019-04-20  2:25       ` Chris Marusich
2019-04-20  1:07   ` [bug#35333] [PATCH 2/6] gnu: Add python-pyscard and python2-pyscard Chris Marusich
2019-04-20  1:07   ` [bug#35333] [PATCH 3/6] gnu: Add libu2f-host Chris Marusich
2019-04-20  1:07   ` [bug#35333] [PATCH 4/6] gnu: Add public-suffix-list Chris Marusich
2019-04-20  1:07   ` [bug#35333] [PATCH 5/6] gnu: Add python-fido2 and python2-fido2 Chris Marusich
2019-04-20  1:08   ` [bug#35333] [PATCH 6/6] gnu: Add python-yubikey-manager and python2-yubikey-manager Chris Marusich
2019-04-20  7:32   ` [bug#35333] [PATCH 0/6] Add Yubikey Manager and Its Dependencies Ricardo Wurmus
2019-04-25  4:14     ` bug#35333: " Chris Marusich
2019-04-24 19:24 ` [bug#35333] " Danny Milosavljevic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736mdxxl2.fsf@gmail.com \
    --to=cmmarusich@gmail.com \
    --cc=35333@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).