[Python-checkins] r52277 - sandbox/trunk/import_in_py/test_importer.py
brett.cannon
python-checkins at python.org
Tue Oct 10 22:12:36 CEST 2006
Author: brett.cannon
Date: Tue Oct 10 22:12:36 2006
New Revision: 52277
Modified:
sandbox/trunk/import_in_py/test_importer.py
Log:
Properly clean up after bytecode tests.
Modified: sandbox/trunk/import_in_py/test_importer.py
==============================================================================
--- sandbox/trunk/import_in_py/test_importer.py (original)
+++ sandbox/trunk/import_in_py/test_importer.py Tue Oct 10 22:12:36 2006
@@ -193,10 +193,20 @@
def setUp(self):
"""Make sure that the module has its bytecode generated."""
super(self.__class__, self).setUp()
+ # Bytecode file cleaned up by SourceFileTests.tearDown() thanks to
+ # assigning the bytecode file's path to self.file_path.
+ # But that does leave the original .py file in place; handle that in
+ # tearDown().
py_compile.compile(self.file_path, doraise=True)
self.file_path += 'c' if __debug__ else 'o'
self.handler = importer.PyBytecodeHandler()
+ def tearDown(self):
+ """Clean up the .py file since self.file_path is set to the bytecode
+ file and that is handled in the superclass."""
+ super(self.__class__, self).tearDown()
+ os.remove(self.file_path[:-1])
+
def test_handles_attr(self):
# 'handles' should return 'pyc' or 'pyo' depending on __debug__.
try:
More information about the Python-checkins
mailing list