diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-05-17 19:02:54 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-05-17 19:02:54 (GMT) |
commit | 314a16b0ececffbe33bbca1242dd53022b018f4a (patch) | |
tree | 18424b0c801f4940e0cce32ddbace43aed617f87 /Lib | |
parent | 6c6d3a2f9f031fdf8b12a9f9dbeb178e081b8dbc (diff) | |
download | cpython-314a16b0ececffbe33bbca1242dd53022b018f4a.zip cpython-314a16b0ececffbe33bbca1242dd53022b018f4a.tar.gz cpython-314a16b0ececffbe33bbca1242dd53022b018f4a.tar.bz2 |
Make the test completely clean up after itself.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_threaded_import.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py index d67c904..f540bdc 100644 --- a/Lib/test/test_threaded_import.py +++ b/Lib/test/test_threaded_import.py @@ -12,7 +12,7 @@ import time import shutil import unittest from test.support import ( - verbose, import_module, run_unittest, TESTFN, reap_threads, forget) + verbose, import_module, run_unittest, TESTFN, reap_threads, forget, unlink) threading = import_module('threading') def task(N, done, done_tasks, errors): @@ -214,8 +214,10 @@ class ThreadedImportTests(unittest.TestCase): t.join()""" sys.path.insert(0, os.curdir) self.addCleanup(sys.path.remove, os.curdir) - with open(TESTFN + ".py", "wb") as f: + filename = TESTFN + ".py" + with open(filename, "wb") as f: f.write(code.encode('utf-8')) + self.addCleanup(unlink, filename) self.addCleanup(forget, TESTFN) __import__(TESTFN) |