From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Roelandt Subject: [PATCH 3/5] gnu: Enable tests in Python 3. Date: Fri, 7 Mar 2014 03:47:33 +0100 Message-ID: <1394160455-32580-4-git-send-email-tipecaml@gmail.com> References: <1394160455-32580-1-git-send-email-tipecaml@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLkv0-0007bd-NJ for guix-devel@gnu.org; Thu, 06 Mar 2014 21:53:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLkuw-00078U-Jf for guix-devel@gnu.org; Thu, 06 Mar 2014 21:53:50 -0500 Received: from mail-wg0-x230.google.com ([2a00:1450:400c:c00::230]:41297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLkuw-000786-6t for guix-devel@gnu.org; Thu, 06 Mar 2014 21:53:46 -0500 Received: by mail-wg0-f48.google.com with SMTP id b13so4281542wgh.7 for ; Thu, 06 Mar 2014 18:53:45 -0800 (PST) In-Reply-To: <1394160455-32580-1-git-send-email-tipecaml@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org * gnu/packages/python.scm: enable tests for Python 3 * gnu/packages/python-fix-tests.patch: New file. * gnu/packages/gnu-sysem.am (dist_patch_DATA): add it. --- gnu-system.am | 1 + gnu/packages/patches/python-fix-tests.patch | 62 +++++++++++++++++++++++++++++ gnu/packages/python.scm | 22 +++++++++- 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/python-fix-tests.patch diff --git a/gnu-system.am b/gnu-system.am index b5be893..6ef6edf 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -307,6 +307,7 @@ dist_patch_DATA = \ gnu/packages/patches/pulseaudio-test-timeouts.patch \ gnu/packages/patches/pulseaudio-volume-test.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..23ef17f --- /dev/null +++ b/gnu/packages/patches/python-fix-tests.patch @@ -0,0 +1,62 @@ +--- Lib/test/test_shutil.py 2014-03-01 04:56:37.768311000 +0100 ++++ Lib/test/test_shutil.py 2014-03-01 03:02:36.088311000 +0100 +@@ -1053,7 +1053,6 @@ + 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 +@@ -1082,7 +1081,6 @@ + + + @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-01 06:20:50.704311000 +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 2014-03-02 22:14:12.264311000 +0100 ++++ Lib/test/test_socket.py 2014-03-03 01:12:21.360311000 +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 uses /etc/gai.conf, which is not in the chroot") + 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 uses /etc/gai.conf, which is not in the chroot") + @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 a663b5e..f58e6db 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -154,8 +154,17 @@ (string-append "args = [\"/bin/sh\" if os.path.exists(\"/bin/sh\") else " "\"" (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) @@ -191,9 +200,20 @@ data types.") (method url-fetch) (uri (string-append "http://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? _) + `(list #t))))) (native-search-paths (list (search-path-specification (variable "PYTHONPATH") -- 1.8.4.rc3