all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Cyril Roelandt <tipecaml@gmail.com>
To: guix-devel@gnu.org
Subject: [PATCH 3/4 v2] gnu: Enable tests in Python 3.
Date: Fri, 21 Mar 2014 05:12:20 +0100	[thread overview]
Message-ID: <1395375140-18122-1-git-send-email-tipecaml@gmail.com> (raw)
In-Reply-To: <878usm9wik.fsf@gnu.org>

* gnu/packages/python.scm: enable tests for Python 3
* gnu/packages/python-fix-tests.patch: New file.
* gnu/packages/gnu-system.am (dist_patch_DATA): add it.
---
 gnu-system.am                               |  1 +
 gnu/packages/patches/python-fix-tests.patch | 66 +++++++++++++++++++++++++++++
 gnu/packages/python.scm                     | 21 ++++++++-
 3 files changed, 87 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/python-fix-tests.patch

diff --git a/gnu-system.am b/gnu-system.am
index 52c58d8..91896ba 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -311,6 +311,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/plotutils-libpng-jmpbuf.patch		\
   gnu/packages/patches/procps-make-3.82.patch			\
   gnu/packages/patches/python-fix-dbm.patch			\
+  gnu/packages/patches/python-fix-tests.patch			\
   gnu/packages/patches/qemu-make-4.0.patch			\
   gnu/packages/patches/qemu-multiple-smb-shares.patch		\
   gnu/packages/patches/qt4-tests.patch				\
diff --git a/gnu/packages/patches/python-fix-tests.patch b/gnu/packages/patches/python-fix-tests.patch
new file mode 100644
index 0000000..fecebda
--- /dev/null
+++ b/gnu/packages/patches/python-fix-tests.patch
@@ -0,0 +1,66 @@
+See the discussion about the issues fixed here at:
+http://bugs.python.org/issue20868 .
+
+--- Lib/test/test_shutil.py     2014-03-01 03:02:36.088311000 +0100
++++ Lib/test/test_shutil.py     2014-03-01 04:56:37.768311000 +0100
+@@ -1053,6 +1053,7 @@
+         self.assertRaises(ValueError, make_archive, base_name, 'xxx')
+ 
+     @requires_zlib
++    @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
+     def test_make_archive_owner_group(self):
+         # testing make_archive with owner and group, with various combinations
+         # this works even if there's not gid/uid support
+@@ -1081,6 +1082,7 @@
+ 
+ 
+     @requires_zlib
++    @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
+     @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
+     def test_tarfile_root_owner(self):
+         tmpdir, tmpdir2, base_name =  self._create_files()
+
+--- Lib/test/test_posixpath.py	2014-03-01 05:46:56.984311000 +0100
++++ Lib/test/test_posixpath.py	2014-03-07 00:59:20.888311000 +0100
+@@ -319,7 +319,11 @@
+                 del env['HOME']
+                 home = pwd.getpwuid(os.getuid()).pw_dir
+                 # $HOME can end with a trailing /, so strip it (see #17809)
+-                self.assertEqual(posixpath.expanduser("~"), home.rstrip("/"))
++                # The Guix builders have '/' as a home directory, so
++                # home.rstrip("/") will be an empty string and the test will
++                # fail. Let's just disable it since it does not really make
++                # sense with such a bizarre setup.
++                # self.assertEqual(posixpath.expanduser("~"), home.rstrip("/"))
+ 
+     def test_normpath(self):
+         self.assertEqual(posixpath.normpath(""), ".")
+--- Lib/test/test_socket.py.orig	2014-03-02 22:14:12.264311000 +0100
++++ Lib/test/test_socket.py	2014-03-21 03:50:45.660311000 +0100
+@@ -819,6 +819,8 @@
+             self.assertRaises(OverflowError, socket.htonl, k)
+             self.assertRaises(OverflowError, socket.htons, k)
+ 
++    @unittest.skipUnless(os.path.exists("/etc/services"),
++                         "getservbyname uses /etc/services, which is not in the chroot")
+     def testGetServBy(self):
+         eq = self.assertEqual
+         # Find one service that exists, then check all the related interfaces.
+@@ -1104,6 +1106,8 @@
+         self.assertRaises(ValueError, s.ioctl, -1, None)
+         s.ioctl(socket.SIO_KEEPALIVE_VALS, (1, 100, 100))
+ 
++    @unittest.skipUnless(os.path.exists("/etc/gai.conf"),
++                         "getaddrinfo() will fail")
+     def testGetaddrinfo(self):
+         try:
+             socket.getaddrinfo('localhost', 80)
+@@ -1174,6 +1178,8 @@
+         # only IP addresses are allowed
+         self.assertRaises(socket.error, socket.getnameinfo, ('mail.python.org',0), 0)
+ 
++    @unittest.skipUnless(os.path.exists("/etc/gai.conf"),
++                         "getaddrinfo() will fail")
+     @unittest.skipUnless(support.is_resource_enabled('network'),
+                          'network is not enabled')
+     def test_idna(self):
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 2c69926..01de2f6 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -146,8 +146,17 @@
              (substitute* "Lib/subprocess.py"
                (("args = \\[\"/bin/sh")
                 (string-append "args = [\"" (which "sh"))))
+             (substitute*
+               '("Lib/distutils/tests/test_spawn.py"
+                 "Lib/test/test_subprocess.py")
+               (("/bin/sh") (which "sh")))
              (apply configure args)))
-          %standard-phases))))
+          (alist-cons-before
+           'check 'pre-check
+           (lambda _
+             ;; 'Lib/test/test_site.py' needs a valid $HOME
+             (setenv "HOME" (getcwd)))
+           %standard-phases)))))
     (inputs
      `(("bzip2" ,bzip2)
        ("gdbm" ,gdbm)
@@ -183,9 +192,19 @@ data types.")
       (method url-fetch)
       (uri (string-append "https://www.python.org/ftp/python/"
                           version "/Python-" version ".tar.xz"))
+       (patches (list (search-patch "python-fix-tests.patch")))
+       (patch-flags '("-p0"))
       (sha256
        (base32
         "11f6hg9wdhm6hyzj49gxlvvp1s0l5hqgcsq1i4ayygqs1arpb4ik"))))
+    (arguments
+     (let ((args `(#:modules ((guix build gnu-build-system)
+                              (guix build utils)
+                             (srfi srfi-1)
+                              (srfi srfi-26))
+                   ,@(package-arguments python-2))))
+       (substitute-keyword-arguments args
+         ((#:tests? _) #t))))
     (native-search-paths
      (list (search-path-specification
             (variable "PYTHONPATH")
-- 
1.8.4.rc3

  reply	other threads:[~2014-03-21  4:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07  2:47 [PATCH 0/5] Python improvements Cyril Roelandt
2014-03-07  2:47 ` [PATCH 1/5] gnu: Enable the 'ctypes' module in Python Cyril Roelandt
2014-03-07  9:28   ` Ludovic Courtès
2014-03-07  2:47 ` [PATCH 2/5] gnu: Python: use /nix/.../sh if /bin/sh cannot be found Cyril Roelandt
2014-03-07  9:31   ` Ludovic Courtès
2014-03-22  3:36     ` [PATCH 2/4 v2] gnu: Python: use /nix/.../sh instead of /bin/sh in the subprocess module Cyril Roelandt
2014-03-22 14:26       ` Ludovic Courtès
2014-03-07  2:47 ` [PATCH 3/5] gnu: Enable tests in Python 3 Cyril Roelandt
2014-03-07  9:40   ` Ludovic Courtès
2014-03-21  4:12     ` Cyril Roelandt [this message]
2014-03-22 14:32       ` [PATCH 3/4 v2] " Ludovic Courtès
2014-03-21  4:14     ` [PATCH 3/5] " Cyril Roelandt
2014-03-21 13:15       ` Ludovic Courtès
2014-03-22 23:13         ` Cyril Roelandt
2014-03-23 10:43           ` Ludovic Courtès
2014-03-07  2:47 ` [PATCH 4/5] gnu: Python: bump to 3.3.4 Cyril Roelandt
2014-03-07  9:31   ` Ludovic Courtès
2014-03-21  4:07     ` Cyril Roelandt
2014-03-21 13:02       ` Ludovic Courtès
2014-03-07  2:47 ` [PATCH 5/5] gnu: remove python-fix-dbm.patch Cyril Roelandt
2014-03-07  9:32   ` Ludovic Courtès

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

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

  git send-email \
    --in-reply-to=1395375140-18122-1-git-send-email-tipecaml@gmail.com \
    --to=tipecaml@gmail.com \
    --cc=guix-devel@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.