[Python-checkins] bpo-39502: Skip test_zipfile.test_add_file_after_2107() on AIX (GH-18282)

Victor Stinner webhook-mailer at python.org
Thu Jan 30 09:47:58 EST 2020


https://github.com/python/cpython/commit/c232c9110cfefa0935cbf158e35e91746a8a9361
commit: c232c9110cfefa0935cbf158e35e91746a8a9361
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-01-30T15:47:53+01:00
summary:

bpo-39502: Skip test_zipfile.test_add_file_after_2107() on AIX (GH-18282)

Skip test_zipfile.test_add_file_after_2107() if time.localtime()
fails with OverflowError. It is the case on AIX 6.1 for example.

files:
A Misc/NEWS.d/next/Tests/2020-01-30-15-04-54.bpo-39502.chbpII.rst
M Lib/test/test_zipfile.py

diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 4c20bfd7e2cd7..c334715f3d81b 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -611,8 +611,13 @@ def test_add_file_before_1980(self):
 
     def test_add_file_after_2107(self):
         # Set atime and mtime to 2108-12-30
+        ts = 4386268800
         try:
-            os.utime(TESTFN, (4386268800, 4386268800))
+            time.localtime(ts)
+        except OverflowError:
+            self.skipTest(f'time.localtime({ts}) raises OverflowError')
+        try:
+            os.utime(TESTFN, (ts, ts))
         except OverflowError:
             self.skipTest('Host fs cannot set timestamp to required value.')
 
diff --git a/Misc/NEWS.d/next/Tests/2020-01-30-15-04-54.bpo-39502.chbpII.rst b/Misc/NEWS.d/next/Tests/2020-01-30-15-04-54.bpo-39502.chbpII.rst
new file mode 100644
index 0000000000000..0a13746e34759
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2020-01-30-15-04-54.bpo-39502.chbpII.rst
@@ -0,0 +1,2 @@
+Skip test_zipfile.test_add_file_after_2107() if :func:`time.localtime` fails
+with :exc:`OverflowError`. It is the case on AIX 6.1 for example.



More information about the Python-checkins mailing list