From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from eggs.gnu.org ([209.51.188.92]:43844)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hHf11-0006RS-Fp
	for guix-patches@gnu.org; Fri, 19 Apr 2019 21:42:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hHf10-00088k-0h
	for guix-patches@gnu.org; Fri, 19 Apr 2019 21:42:03 -0400
Received: from debbugs.gnu.org ([209.51.188.43]:59852)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
	id 1hHf0z-00088f-SK
	for guix-patches@gnu.org; Fri, 19 Apr 2019 21:42:01 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hHf0z-0007PX-OG
	for guix-patches@gnu.org; Fri, 19 Apr 2019 21:42:01 -0400
Subject: [bug#35333] [PATCH 1/6] gnu: Add python-pyfakefs and python2-pyfakefs.
Resent-Message-ID: <handler.35333.B35333.155572449028441@debbugs.gnu.org>
From: Chris Marusich <cmmarusich@gmail.com>
References: <20190420003814.5120-1-cmmarusich@gmail.com>
	<20190420010800.5741-1-cmmarusich@gmail.com>
	<20190420010800.5741-2-cmmarusich@gmail.com>
Date: Fri, 19 Apr 2019 18:41:13 -0700
In-Reply-To: <20190420010800.5741-2-cmmarusich@gmail.com> (Chris Marusich's
	message of "Fri, 19 Apr 2019 18:07:55 -0700")
Message-ID: <8736mdxxl2.fsf@gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="==-=-=";
	micalg=pgp-sha256; protocol="application/pgp-signature"
List-Id: <guix-patches.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>,
	<mailto:guix-patches-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/guix-patches/>
List-Post: <mailto:guix-patches@gnu.org>
List-Help: <mailto:guix-patches-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>,
	<mailto:guix-patches-request@gnu.org?subject=subscribe>
Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org
Sender: "Guix-patches" <guix-patches-bounces+kyle=kyleam.com@gnu.org>
To: 35333@debbugs.gnu.org

--==-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Chris Marusich <cmmarusich@gmail.com> writes:

> +              ;; Guix lint doesn't like that this release is an autogene=
rated
> +              ;; archive, but it seems those are the only releases avail=
able.
> +              (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.

=2D-=20
Chris

--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: attachment;
 filename=0001-gnu-Add-python-pyfakefs-and-python2-pyfakefs.patch
Content-Transfer-Encoding: quoted-printable

From=20f2091091a90fc25d21e0191df88cf10c6e9890dd 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.
=2D--
 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.pa=
tch

diff --git a/gnu/local.mk b/gnu/local.mk
index 41924a7de5..3953e5b789 100644
=2D-- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1201,6 +1201,7 @@ dist_patch_DATA =3D						\
   %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
=2D-- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -29,6 +29,7 @@
 ;;; Copyright =C2=A9 2017, 2018 Ludovic Court=C3=A8s <ludo@gnu.org>
 ;;; Copyright =C2=A9 2018 Fis Trivial <ybbs.daans@hotmail.com>
 ;;; Copyright =C2=A9 2019 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright =C2=A9 2019 Chris Marusich <cmmarusich@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2262,3 +2263,52 @@ record the properties and behaviour of particular de=
vices, 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 plac=
e.
+              (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 Git=
Hub
+    ;; page, but the pyfakefs documentation asks us to use this specific U=
RL
+    ;; 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 m=
ight
+need to read or write to files in the local file system.  If the file syst=
em
+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 pyfakef=
s.")
+    (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/g=
nu/packages/patches/python-pyfakefs-remove-bad-test.patch
new file mode 100644
index 0000000000..a9488bbe43
=2D-- /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('~'),=0D
+                              self.os.environ['HOME'].replace('/', '!'))=0D
+ =0D
+-    @unittest.skipIf(TestCase.is_windows or TestCase.is_cygwin,=0D
+-                     'only tested on unix systems')=0D
+-    def test_expand_root(self):=0D
+-        if sys.platform =3D=3D 'darwin':=0D
+-            roothome =3D '!var!root'=0D
+-        else:=0D
+-            roothome =3D '!root'=0D
+-        self.assertEqual(self.path.expanduser('~root'), roothome)=0D
+-=0D
+     def test_getsize_path_nonexistent(self):=0D
+         file_path =3D 'foo!bar!baz'=0D
+         self.assertRaises(os.error, self.path.getsize, file_path)=0D
=2D-=20
2.20.1


--=-=-=--

--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAly6eLkACgkQ3UCaFdgi
Rp2eDA//eio8Y4BN3OzaZFjA/wEX+5j/pHlYA62/1Kg9SrZn1/xFLYY3z56CvJ6x
jlVXJbb2MiG3fSHkecTb5kIFARnJmSrwHYMcmZdEI3BcKzUIWpE4CeaUksBz0DPK
7VfXVpA0iwTNsu/l/nd8poNGUEPZIuGChge2wvKwJTE2HwQfi/UksL+I8p3HBInA
w5k0XjwPHCtR1Z7XOmCTRX+myHvq2l/NpTSJKr82azPm53bEh9t0U2FOQnH77uhD
KA5thSxw3YC0tbaUOULG1/HXubMrFT4flPccHpuqEjaJw8H/x22gcMlGCQLMH6VG
8dCQj1TzpztA3dazz4Fy+rv0Aoe2ranEc5DIe5FTiyKzNaG9zEtmmY0wCKLhqkXb
VeoS/EqTaHPVbtBMUp2sGWWPWEkaO/IFIaBV87IeF3K3B5dWCO2bz3Beld1nRYhy
cWVHD68lRvoQMAPLi822bhSZI/TV3+UuQZCjfjs/ignAF+W8Jb/PF9c7ZCLA4wHX
LpXAM8Ji/7bdoMQoHGFoODBVPp2Nz1fTkQ0kn+QgTjyRi6cbulIYDpO9fyaB2jZy
l3twaLGe/aqwNvQ5g3XkV8xkxd+lcMdteo97A2pBx3u+cgye6aOAWU30eEqmMBKF
LhshwnJc1rtFbDVIXadOvbd1m2v8AKo7wCMGcKOoJqzXzpSyXW4=
=KgT6
-----END PGP SIGNATURE-----
--==-=-=--