Skip to content

Commit

Permalink
This test failed under python -O.
Browse files Browse the repository at this point in the history
rewrite_file():  Delete both .pyc and .pyo leftovers, and explicitly close
the new source file after writing to it.
  • Loading branch information
tim-one committed Aug 2, 2001
1 parent 044bb4d commit d342c62
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Lib/test/test_pkgimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ def tearDown(self):
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):

Expand Down

0 comments on commit d342c62

Please sign in to comment.