File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -313,14 +313,22 @@ def __del__(self):
313313 def test_timestamp_overflow (self ):
314314 # A modification timestamp larger than 2**32 should not be a problem
315315 # when importing a module (issue #11235).
316- source = TESTFN + ".py"
317- compiled = imp .cache_from_source (source )
318- with open (source , 'w' ) as f :
319- pass
320- os .utime (source , (2 ** 33 , 2 ** 33 ))
321- __import__ (TESTFN )
322- # The pyc file was created.
323- os .stat (compiled )
316+ sys .path .insert (0 , os .curdir )
317+ try :
318+ source = TESTFN + ".py"
319+ compiled = imp .cache_from_source (source )
320+ with open (source , 'w' ) as f :
321+ pass
322+ try :
323+ os .utime (source , (2 ** 33 , 2 ** 33 ))
324+ except OverflowError :
325+ self .skipTest ("cannot set modification time to large integer" )
326+ __import__ (TESTFN )
327+ # The pyc file was created.
328+ os .stat (compiled )
329+ finally :
330+ del sys .path [0 ]
331+ remove_files (TESTFN )
324332
325333
326334class PycRewritingTests (unittest .TestCase ):
You can’t perform that action at this time.
0 commit comments