Skip to content

Commit d4d4f27

Browse files
authored
fix
1 parent 4f597f7 commit d4d4f27

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Lib/test/test_zipfile/test_core.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,24 +1836,22 @@ def test_write_unicode_filenames(self):
18361836

18371837
def test_write_with_source_date_epoch(self):
18381838
os.environ['SOURCE_DATE_EPOCH'] = "1727268221"
1839-
data = "Testing SOURCE_DATE_EPOCH"
18401839

1841-
with zipfile.ZipFile(self.TESTFN, "w") as zf:
1842-
zf.writestr("test_source_date_epoch.txt", data)
1840+
with zipfile.ZipFile(TESTFN, "w") as zf:
1841+
zf.writestr("test_source_date_epoch.txt", "Testing SOURCE_DATE_EPOCH")
18431842

1844-
with zipfile.ZipFile(self.TESTFN, "r") as zf:
1843+
with zipfile.ZipFile(TESTFN, "r") as zf:
18451844
zip_info = zf.getinfo("test_source_date_epoch.txt")
18461845
self.assertEqual(zip_info.date_time, time.gmtime(int(os.environ['SOURCE_DATE_EPOCH']))[:6])
18471846

18481847
def test_write_without_source_date_epoch(self):
18491848
if 'SOURCE_DATE_EPOCH' in os.environ:
18501849
del os.environ['SOURCE_DATE_EPOCH']
1851-
data = "Testing without SOURCE_DATE_EPOCH"
18521850

1853-
with zipfile.ZipFile(self.TESTFN, "w") as zf:
1854-
zf.writestr("test_no_source_date_epoch.txt", data)
1851+
with zipfile.ZipFile(TESTFN, "w") as zf:
1852+
zf.writestr("test_no_source_date_epoch.txt", "Testing without SOURCE_DATE_EPOCH")
18551853

1856-
with zipfile.ZipFile(self.TESTFN, "r") as zf:
1854+
with zipfile.ZipFile(TESTFN, "r") as zf:
18571855
zip_info = zf.getinfo("test_no_source_date_epoch.txt")
18581856
current_time = time.gmtime()[:6]
18591857
self.assertNotEqual(zip_info.date_time, current_time)

0 commit comments

Comments
 (0)