[Python-checkins] cpython (3.4): Issue #22390: Remove files created by tests
victor.stinner
python-checkins at python.org
Sun Oct 5 17:39:07 CEST 2014
https://hg.python.org/cpython/rev/8cf8bff3569e
changeset: 92823:8cf8bff3569e
branch: 3.4
parent: 92821:0455cbfd7ae6
user: Victor Stinner <victor.stinner at gmail.com>
date: Sun Oct 05 17:37:41 2014 +0200
summary:
Issue #22390: Remove files created by tests
files:
Lib/test/test_imp.py | 1 +
Lib/test/test_import.py | 1 +
Lib/test/test_pdb.py | 1 +
Lib/test/test_posix.py | 2 +-
Lib/test/test_source_encoding.py | 3 ++-
Lib/test/test_support.py | 1 +
Lib/test/test_threaded_import.py | 4 +++-
7 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -198,6 +198,7 @@
support.unlink(temp_mod_name + ext)
support.unlink(init_file_name + ext)
support.rmtree(test_package_name)
+ support.rmtree('__pycache__')
def test_issue9319(self):
path = os.path.dirname(__file__)
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -1062,6 +1062,7 @@
# Issue #11619: The Python parser and the import machinery must not
# encode filenames, especially on Windows
pyname = script_helper.make_script('', TESTFN_UNENCODABLE, 'pass')
+ self.addCleanup(unlink, pyname)
name = pyname[:-3]
script_helper.assert_python_ok("-c", "mod = __import__(%a)" % name,
__isolated=False)
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -916,6 +916,7 @@
with open(filename, 'w') as f:
f.write(textwrap.dedent(script))
self.addCleanup(support.unlink, filename)
+ self.addCleanup(support.rmtree, '__pycache__')
cmd = [sys.executable, '-m', 'pdb', filename]
stdout = stderr = None
with subprocess.Popen(cmd, stdout=subprocess.PIPE,
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1125,7 +1125,7 @@
"""
Test functions that call path_error2(), providing two filenames in their exceptions.
"""
- for name in ("rename", "replace", "link", "symlink"):
+ for name in ("rename", "replace", "link"):
function = getattr(os, name, None)
if function:
diff --git a/Lib/test/test_source_encoding.py b/Lib/test/test_source_encoding.py
--- a/Lib/test/test_source_encoding.py
+++ b/Lib/test/test_source_encoding.py
@@ -1,7 +1,7 @@
# -*- coding: koi8-r -*-
import unittest
-from test.support import TESTFN, unlink, unload
+from test.support import TESTFN, unlink, unload, rmtree
import importlib
import os
import sys
@@ -129,6 +129,7 @@
unlink(filename + "c")
unlink(filename + "o")
unload(TESTFN)
+ rmtree('__pycache__')
def test_error_from_string(self):
# See http://bugs.python.org/issue6289
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -69,6 +69,7 @@
finally:
del sys.path[0]
support.unlink(mod_filename)
+ support.rmtree('__pycache__')
def test_HOST(self):
s = socket.socket()
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
@@ -13,7 +13,8 @@
import shutil
import unittest
from test.support import (
- verbose, import_module, run_unittest, TESTFN, reap_threads, forget, unlink)
+ verbose, import_module, run_unittest, TESTFN, reap_threads,
+ forget, unlink, rmtree)
threading = import_module('threading')
def task(N, done, done_tasks, errors):
@@ -222,6 +223,7 @@
f.write(code.encode('utf-8'))
self.addCleanup(unlink, filename)
self.addCleanup(forget, TESTFN)
+ self.addCleanup(rmtree, '__pycache__')
importlib.invalidate_caches()
__import__(TESTFN)
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list