From 680bc34da4aa067f2d35d6a4015cd33e32dfed2f Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Tue, 9 Jul 2019 20:59:58 +0200 Subject: [PATCH] gnu: Python: Update to 3.7.4. * gnu/packages/python.scm (python-3.7): Update to 3.7.4. [source](snippet): Move disabled tests ... [arguments]<#:make-flags>: ... here. Enable previously failing tests. <#:phases>: Add 'set-TZDIR'. [native-inputs]: Add TZDATA-FOR-TESTS. * gnu/packages/commencement.scm (python-boot0)[arguments]: Clear <#:make-flags>. Delete 'set-TZDIR' phase. * gnu/packages/patches/python-3-fix-tests.patch: Disable two new tests that do not work in the build container. Adjust context. --- gnu/packages/commencement.scm | 6 ++- gnu/packages/patches/python-3-fix-tests.patch | 38 ++++++++++++---- gnu/packages/python.scm | 44 ++++++++++--------- 3 files changed, 57 insertions(+), 31 deletions(-) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index d06aa0a369..ff34392865 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -1887,6 +1887,9 @@ the bootstrap environment." ((#:configure-flags _ ''()) `(list "--without-ensurepip" "--without-threads")) + ;; Clear #:make-flags, such that changes to the regular + ;; Python package won't interfere with this one. + ((#:make-flags _ ''()) ''()) ((#:phases phases) `(modify-phases ,phases (add-before 'configure 'disable-modules @@ -1897,7 +1900,8 @@ the bootstrap environment." ;; Prevent the 'ossaudiodev' extension from being ;; built, since it requires Linux headers. (("'linux', ") "")) - #t)))) + #t)) + (delete 'set-TZDIR))) ((#:tests? _ #f) #f)))))) (package-with-bootstrap-guile (package-with-explicit-inputs python %boot0-inputs diff --git a/gnu/packages/patches/python-3-fix-tests.patch b/gnu/packages/patches/python-3-fix-tests.patch index e4ba728a7e..e13790bd41 100644 --- a/gnu/packages/patches/python-3-fix-tests.patch +++ b/gnu/packages/patches/python-3-fix-tests.patch @@ -85,7 +85,7 @@ diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing. diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py -@@ -1301,6 +1301,8 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase): +@@ -1323,6 +1323,8 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase): self._test_create_connection_ip_addr(m_socket, False) @patch_socket @@ -128,7 +128,7 @@ diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py -@@ -2130,8 +2130,7 @@ class PosixPathTest(_BasePathTest, unittest.TestCase): +@@ -2134,8 +2134,7 @@ class PosixPathTest(_BasePathTest, unittest.TestCase): self.assertEqual(given, expect) self.assertEqual(set(p.rglob("FILEd*")), set()) @@ -141,7 +141,7 @@ diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py -@@ -1133,11 +1133,11 @@ def test_pdb_issue_20766(): +@@ -1150,11 +1150,11 @@ def test_pdb_issue_20766(): > (6)test_function() -> print('pdb %d: %s' % (i, sess._previous_sigint_handler)) (Pdb) continue @@ -158,7 +158,7 @@ diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py -@@ -764,6 +764,7 @@ class ArgsTestCase(BaseTestCase): +@@ -762,6 +762,7 @@ class ArgsTestCase(BaseTestCase): output = self.run_tests('--fromfile', filename) self.check_executed_tests(output, tests) @@ -166,12 +166,12 @@ diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py def test_interrupted(self): code = TEST_INTERRUPTED test = self.create_test('sigint', code=code) -@@ -781,6 +782,7 @@ class ArgsTestCase(BaseTestCase): +@@ -779,6 +780,7 @@ class ArgsTestCase(BaseTestCase): % (self.TESTNAME_REGEX, len(tests))) self.check_line(output, regex) + @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment.') - def test_slow_interrupted(self): + def test_slowest_interrupted(self): # Issue #25373: test --slowest with an interrupted test code = TEST_INTERRUPTED diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py @@ -188,7 +188,7 @@ diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py -@@ -1135,6 +1135,7 @@ class TestShutil(unittest.TestCase): +@@ -1143,6 +1143,7 @@ class TestShutil(unittest.TestCase): self.assertRaises(ValueError, make_archive, base_name, 'xxx') @support.requires_zlib @@ -196,7 +196,7 @@ diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py 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 -@@ -1163,6 +1164,7 @@ class TestShutil(unittest.TestCase): +@@ -1171,6 +1172,7 @@ class TestShutil(unittest.TestCase): @support.requires_zlib @@ -269,7 +269,7 @@ diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py -@@ -2504,9 +2504,12 @@ def root_is_uid_gid_0(): +@@ -2509,9 +2509,12 @@ def root_is_uid_gid_0(): import pwd, grp except ImportError: return False @@ -285,6 +285,26 @@ diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py return False return True +diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py +--- a/Lib/test/test_threading.py ++++ b/Lib/test/test_threading.py +@@ -1249,6 +1249,7 @@ class MiscTestCase(unittest.TestCase): + + + class InterruptMainTests(unittest.TestCase): ++ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build container.') + def test_interrupt_main_subthread(self): + # Calling start_new_thread with a function that executes interrupt_main + # should raise KeyboardInterrupt upon completion. +@@ -1260,6 +1261,8 @@ class InterruptMainTests(unittest.TestCase): + t.join() + t.join() + ++ ++ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build container.') + def test_interrupt_main_mainthread(self): + # Make sure that if interrupt_main is called in main thread that + # KeyboardInterrupt is raised instantly. diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py --- a/Tools/scripts/run_tests.py +++ b/Tools/scripts/run_tests.py diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 68ea23ff57..9fec18287e 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -76,6 +76,7 @@ (define-module (gnu packages python) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) + #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages compression) #:use-module (gnu packages dbm) @@ -324,7 +325,7 @@ data types.") (define-public python-3.7 (package (inherit python-2) (name "python") - (version "3.7.3") + (version "3.7.4") (source (origin (method url-fetch) (uri (string-append "https://www.python.org/ftp/python/" @@ -335,7 +336,7 @@ data types.") "python-3-search-paths.patch")) (sha256 (base32 - "066ka8csjwkycqpgyv424d8hhqhfd7r6svsp4sfcvkylci0baq6s")) + "0gxiv5617zd7dnqm5k9r4q2188lk327nf9jznwq9j6b8p0s92ygv")) (modules '((guix build utils))) (snippet '(begin @@ -344,33 +345,31 @@ data types.") (substitute* "Modules/Setup.dist" ;; Link Expat instead of embedding the bundled one. (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n")) - - (for-each delete-file - '(;; This test may hang and eventually run out of - ;; memory on some systems: - ;; - "Lib/test/test_socket.py" - - ;; Delete test that fails on low-memory systems. - "Lib/test/test_mmap.py" - - ;; These tests fail on AArch64. - "Lib/ctypes/test/test_win32.py" - "Lib/test/test_fcntl.py" - "Lib/test/test_posix.py")) #t)))) (arguments (substitute-keyword-arguments (package-arguments python-2) ((#:make-flags _) `(list (string-append (format #f "TESTOPTS=-j~d" (parallel-job-count)) - ;; Exclude the following test, which fails as of 3.7.3 (see: - ;; https://bugs.python.org/issue35998). - ;; Exclude test_email, which fails with glibc 2.29 and later - ;; (see ). - " --exclude test_asyncio test_email"))) + ;; test_mmap fails on low-memory systems. + " --exclude test_mmap" + ;; test_socket may hang and eventually run out of memory + ;; on some systems: . + " test_socket" + ;; XXX: test_ctypes fails on some platforms due to a problem in + ;; libffi 3.2.1: . + ,@(if (string-prefix? "aarch64" (%current-system)) + '(" test_ctypes") + '())))) ((#:phases phases) `(modify-phases ,phases + (add-before 'check 'set-TZDIR + (lambda* (#:key inputs #:allow-other-keys) + ;; test_email requires the Olson time zone database. + (setenv "TZDIR" + (string-append (assoc-ref inputs "tzdata") + "/share/zoneinfo")) + #t)) ;; Unset SOURCE_DATE_EPOCH while running the test-suite and set it ;; again afterwards. See . (add-before 'check 'unset-SOURCE_DATE_EPOCH @@ -399,6 +398,9 @@ data types.") (find-files out "\\.py$"))) (list '() '("-O") '("-OO"))) #t))))))) + (native-inputs + `(("tzdata" ,tzdata-for-tests) + ,@(package-native-inputs python-2))) (native-search-paths (list (search-path-specification (variable "PYTHONPATH")