summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-05-17 19:02:54 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-05-17 19:02:54 (GMT)
commit314a16b0ececffbe33bbca1242dd53022b018f4a (patch)
tree18424b0c801f4940e0cce32ddbace43aed617f87 /Lib
parent6c6d3a2f9f031fdf8b12a9f9dbeb178e081b8dbc (diff)
downloadcpython-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.py6
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)