Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a8d851

Browse files
committed
Bug #1057993: Use sleep() always instead of os.utime() possibly broken
in some platforms.
1 parent 87d6fc5 commit 4a8d851

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

Lib/test/test_traceback.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@ def test_bug737473(self):
5252
def test():
5353
raise ValueError"""
5454

55-
# if this test runs fast, test_bug737473.py will have same mtime
56-
# even if it's rewrited and it'll not reloaded. so adjust mtime
57-
# of original to past.
58-
if hasattr(os, 'utime'):
59-
past = time.time() - 3
60-
os.utime(testfile, (past, past))
61-
else:
62-
time.sleep(3)
63-
6455
if 'test_bug737473' in sys.modules:
6556
del sys.modules['test_bug737473']
6657
import test_bug737473
@@ -71,6 +62,11 @@ def test():
7162
# this loads source code to linecache
7263
traceback.extract_tb(sys.exc_traceback)
7364

65+
# If this test runs fast, test_bug737473.py will stay in a mtime
66+
# even if it's rewrited and it'll not reloaded in result. So wait
67+
# until new timestamp comes.
68+
time.sleep(2)
69+
7470
print >> open(testfile, 'w'), """\
7571
def test():
7672
raise NotImplementedError"""

0 commit comments

Comments
 (0)