From: Antoine Pitrou Date: Wed, 21 Dec 2011 14:53:16 +0000 (+0100) Subject: Issue #13645: fix test_import failure when run immediately after test_coding. X-Git-Tag: v3.3.0a1~544^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f0a49a9e27075478af9eb57ce45ecb10c6a6d383;p=thirdparty%2FPython%2Fcpython.git Issue #13645: fix test_import failure when run immediately after test_coding. --- f0a49a9e27075478af9eb57ce45ecb10c6a6d383 diff --cc Lib/test/test_import.py index 86ef40ec7743,c69575729d68..9f80b70284dd --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@@ -103,9 -104,12 +103,10 @@@ class ImportTests(unittest.TestCase) sys.path.insert(0, os.curdir) try: fname = TESTFN + os.extsep + "py" - open(fname, 'w').close() - os.chmod(fname, (stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | - stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)) + create_empty_file(fname) - __import__(TESTFN) fn = imp.cache_from_source(fname) + unlink(fn) + __import__(TESTFN) if not os.path.exists(fn): self.fail("__import__ did not result in creation of " "either a .pyc or .pyo file")