diff options
Diffstat (limited to 'Lib/test')
-rwxr-xr-x | Lib/test/test_pathlib.py | 14 | ||||
-rw-r--r-- | Lib/test/test_zipfile.py | 4 | ||||
-rw-r--r-- | Lib/test/test_zipfile64.py | 4 |
3 files changed, 13 insertions, 9 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 6663ffa..4108d5e 100755 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1391,11 +1391,8 @@ class _BasePathTest(object): # The file mtime should be refreshed by calling touch() again p.touch() st = p.stat() - # Issue #19715: there can be an inconsistency under Windows between - # the timestamp rounding when creating a file, and the timestamp - # rounding done when calling utime(). `delta` makes up for this. - delta = 1e-6 if os.name == 'nt' else 0 - self.assertGreaterEqual(st.st_mtime, old_mtime - delta) + self.assertGreaterEqual(st.st_mtime_ns, old_mtime_ns) + self.assertGreaterEqual(st.st_mtime, old_mtime) # Now with exist_ok=False p = P / 'newfileB' self.assertFalse(p.exists()) @@ -1403,6 +1400,13 @@ class _BasePathTest(object): self.assertTrue(p.exists()) self.assertRaises(OSError, p.touch, exist_ok=False) + def test_touch_nochange(self): + P = self.cls(BASE) + p = P / 'fileA' + p.touch() + with p.open('rb') as f: + self.assertEqual(f.read().strip(), b"this is file A") + def test_mkdir(self): P = self.cls(BASE) p = P / 'newdirA' diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index 7249b13..c15ea9f 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -506,12 +506,12 @@ class StoredTestZip64InSmallFiles(AbstractTestZip64InSmallFiles, compression = zipfile.ZIP_STORED def large_file_exception_test(self, f, compression): - with zipfile.ZipFile(f, "w", compression) as zipfp: + with zipfile.ZipFile(f, "w", compression, allowZip64=False) as zipfp: self.assertRaises(zipfile.LargeZipFile, zipfp.write, TESTFN, "another.name") def large_file_exception_test2(self, f, compression): - with zipfile.ZipFile(f, "w", compression) as zipfp: + with zipfile.ZipFile(f, "w", compression, allowZip64=False) as zipfp: self.assertRaises(zipfile.LargeZipFile, zipfp.writestr, "another.name", self.data) diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py index a8fb7ab..498d464 100644 --- a/Lib/test/test_zipfile64.py +++ b/Lib/test/test_zipfile64.py @@ -38,7 +38,7 @@ class TestsWithSourceFile(unittest.TestCase): def zipTest(self, f, compression): # Create the ZIP archive. - zipfp = zipfile.ZipFile(f, "w", compression, allowZip64=True) + zipfp = zipfile.ZipFile(f, "w", compression) # It will contain enough copies of self.data to reach about 6GB of # raw data to store. @@ -92,7 +92,7 @@ class OtherTests(unittest.TestCase): def testMoreThan64kFiles(self): # This test checks that more than 64k files can be added to an archive, # and that the resulting archive can be read properly by ZipFile - zipf = zipfile.ZipFile(TESTFN, mode="w") + zipf = zipfile.ZipFile(TESTFN, mode="w", allowZip64=False) zipf.debug = 100 numfiles = (1 << 16) * 3//2 for i in range(numfiles): |