Commit d342c629 authored by Tim Peters's avatar Tim Peters

This test failed under python -O.

rewrite_file():  Delete both .pyc and .pyo leftovers, and explicitly close
the new source file after writing to it.
parent 044bb4d2
......@@ -36,9 +36,13 @@ class TestImport(unittest.TestCase):
self.remove_modules()
def rewrite_file(self, contents):
compiled_path = self.module_path + 'c'
if os.path.exists(compiled_path): os.remove(compiled_path)
open(self.module_path, 'w').write(contents)
for extension in "co":
compiled_path = self.module_path + extension
if os.path.exists(compiled_path):
os.remove(compiled_path)
f = open(self.module_path, 'w')
f.write(contents)
f.close()
def test_package_import__semantics(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment