@@ -1801,17 +1801,17 @@ def test_write_with_source_date_epoch(self):
1801
1801
self .assertAlmostEqual (z_time , g_time , delta = 1 )
1802
1802
1803
1803
def test_write_without_source_date_epoch (self ):
1804
- if 'SOURCE_DATE_EPOCH' in os . environ :
1805
- del os . environ ['SOURCE_DATE_EPOCH' ]
1804
+ with os_helper . EnvironmentVarGuard () as env :
1805
+ del env ['SOURCE_DATE_EPOCH' ]
1806
1806
1807
- with zipfile .ZipFile (TESTFN , "w" ) as zf :
1808
- zf .writestr ("test_no_source_date_epoch.txt" , "Testing without SOURCE_DATE_EPOCH" )
1807
+ with zipfile .ZipFile (TESTFN , "w" ) as zf :
1808
+ zf .writestr ("test_no_source_date_epoch.txt" , "Testing without SOURCE_DATE_EPOCH" )
1809
1809
1810
- with zipfile .ZipFile (TESTFN , "r" ) as zf :
1811
- zip_info = zf .getinfo ("test_no_source_date_epoch.txt" )
1812
- current_time = time .localtime ()[:6 ]
1813
- for z_time , c_time in zip (zip_info .date_time , current_time ):
1814
- self .assertAlmostEqual (z_time , c_time , delta = 1 )
1810
+ with zipfile .ZipFile (TESTFN , "r" ) as zf :
1811
+ zip_info = zf .getinfo ("test_no_source_date_epoch.txt" )
1812
+ current_time = time .localtime ()[:6 ]
1813
+ for z_time , c_time in zip (zip_info .date_time , current_time ):
1814
+ self .assertAlmostEqual (z_time , c_time , delta = 1 )
1815
1815
1816
1816
def test_close (self ):
1817
1817
"""Check that the zipfile is closed after the 'with' block."""
0 commit comments