[Python-checkins] cpython: Make the test completely clean up after itself.
antoine.pitrou
python-checkins at python.org
Thu May 17 21:07:19 CEST 2012
http://hg.python.org/cpython/rev/423a26e8ffbb
changeset: 77016:423a26e8ffbb
parent: 77014:31ac156000c8
user: Antoine Pitrou <solipsis at pitrou.net>
date: Thu May 17 21:02:54 2012 +0200
summary:
Make the test completely clean up after itself.
files:
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
--- a/Lib/test/test_threaded_import.py
+++ b/Lib/test/test_threaded_import.py
@@ -12,7 +12,7 @@
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 @@
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)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list