mirror of https://github.com/python/cpython
Bug #1057993: Use sleep() always instead of os.utime() possibly broken
in some platforms.
This commit is contained in:
parent
87d6fc5161
commit
4a8d851910
|
@ -52,15 +52,6 @@ class TracebackCases(unittest.TestCase):
|
||||||
def test():
|
def test():
|
||||||
raise ValueError"""
|
raise ValueError"""
|
||||||
|
|
||||||
# if this test runs fast, test_bug737473.py will have same mtime
|
|
||||||
# even if it's rewrited and it'll not reloaded. so adjust mtime
|
|
||||||
# of original to past.
|
|
||||||
if hasattr(os, 'utime'):
|
|
||||||
past = time.time() - 3
|
|
||||||
os.utime(testfile, (past, past))
|
|
||||||
else:
|
|
||||||
time.sleep(3)
|
|
||||||
|
|
||||||
if 'test_bug737473' in sys.modules:
|
if 'test_bug737473' in sys.modules:
|
||||||
del sys.modules['test_bug737473']
|
del sys.modules['test_bug737473']
|
||||||
import test_bug737473
|
import test_bug737473
|
||||||
|
@ -71,6 +62,11 @@ def test():
|
||||||
# this loads source code to linecache
|
# this loads source code to linecache
|
||||||
traceback.extract_tb(sys.exc_traceback)
|
traceback.extract_tb(sys.exc_traceback)
|
||||||
|
|
||||||
|
# If this test runs fast, test_bug737473.py will stay in a mtime
|
||||||
|
# even if it's rewrited and it'll not reloaded in result. So wait
|
||||||
|
# until new timestamp comes.
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
print >> open(testfile, 'w'), """\
|
print >> open(testfile, 'w'), """\
|
||||||
def test():
|
def test():
|
||||||
raise NotImplementedError"""
|
raise NotImplementedError"""
|
||||||
|
|
Loading…
Reference in New Issue