]> granicus.if.org Git - python/commitdiff
Issue #22390: Remove files created by tests
authorVictor Stinner <victor.stinner@gmail.com>
Sun, 5 Oct 2014 15:37:41 +0000 (17:37 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Sun, 5 Oct 2014 15:37:41 +0000 (17:37 +0200)
Lib/test/test_imp.py
Lib/test/test_import.py
Lib/test/test_pdb.py
Lib/test/test_posix.py
Lib/test/test_source_encoding.py
Lib/test/test_support.py
Lib/test/test_threaded_import.py

index 024f43894b24aa240ccb89c6406ba9bbbef9b3fa..80b9ec38c5d0cac31ba47b433578b1258ff1ad6c 100644 (file)
@@ -198,6 +198,7 @@ class ImportTests(unittest.TestCase):
                 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__)
index 781a159193acaa0faba5abd60e0a1f1cfac08fbb..b4842c54b565de8af2fbb50cb7cfaaccfd2f70ff 100644 (file)
@@ -1062,6 +1062,7 @@ class ImportTracebackTests(unittest.TestCase):
         # 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)
index 895be02c91974f677726c6a38eb08a082882e7f1..edc9e75438c799948f2b99e8b56a0f876f271fb9 100644 (file)
@@ -916,6 +916,7 @@ class PdbTestCase(unittest.TestCase):
         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,
index 3fae2b187cb87d2f16bc8a7c9bb0500b4d830168..a269db4b327c1952258a9753382f3f6a400c132a 100644 (file)
@@ -1125,7 +1125,7 @@ class PosixTester(unittest.TestCase):
         """
         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:
index 0c41e50662a9f07fbcea498de5f521d86ffa843c..39a7c56019ba6a34785cdb00452a784ef21327eb 100644 (file)
@@ -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 @@ class SourceEncodingTest(unittest.TestCase):
             unlink(filename + "c")
             unlink(filename + "o")
             unload(TESTFN)
+            rmtree('__pycache__')
 
     def test_error_from_string(self):
         # See http://bugs.python.org/issue6289
index 9bd0a01948e07b59ce26ad59a70fcecfda159627..03ce9d19316143ddef64893cbbf2e636079feec6 100644 (file)
@@ -69,6 +69,7 @@ class TestSupport(unittest.TestCase):
         finally:
             del sys.path[0]
             support.unlink(mod_filename)
+            support.rmtree('__pycache__')
 
     def test_HOST(self):
         s = socket.socket()
index c7bfea07a1e726a89137d786db5ac68fb202bd12..192fa08a2659cfe1734b5ebec2480acd0c7a2000 100644 (file)
@@ -13,7 +13,8 @@ import time
 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 @@ class ThreadedImportTests(unittest.TestCase):
             f.write(code.encode('utf-8'))
         self.addCleanup(unlink, filename)
         self.addCleanup(forget, TESTFN)
+        self.addCleanup(rmtree, '__pycache__')
         importlib.invalidate_caches()
         __import__(TESTFN)