A test was not guaranteeing cleanup in the face of an exception.

This commit is contained in:
Brett Cannon 2010-05-15 22:20:16 +00:00
parent c5605ba144
commit 93220d0df1
1 changed files with 8 additions and 7 deletions

View File

@ -163,13 +163,14 @@ class ImportTests(unittest.TestCase):
# Need to be able to load from current dir.
sys.path.append('')
# This used to crash.
exec('import ' + module)
# Cleanup.
del sys.path[-1]
unlink(filename + 'c')
unlink(filename + 'o')
try:
# This used to crash.
exec('import ' + module)
finally:
# Cleanup.
del sys.path[-1]
unlink(filename + 'c')
unlink(filename + 'o')
def test_failing_import_sticks(self):
source = TESTFN + ".py"