summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-10-05 15:38:45 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-10-05 15:38:45 (GMT)
commitd577cea8ab0d929c40de93947dd68b9709607b35 (patch)
tree6c3075232ff9b70ecd47a10e954f7d6403485b2a /Lib/test
parentf4e4b83824318c2415e1d90d00726d07ba8790b9 (diff)
parentbed04a77ee4dde8e1ab7b00557519f01cac734aa (diff)
downloadcpython-d577cea8ab0d929c40de93947dd68b9709607b35.zip
cpython-d577cea8ab0d929c40de93947dd68b9709607b35.tar.gz
cpython-d577cea8ab0d929c40de93947dd68b9709607b35.tar.bz2
Merge 3.4
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_imp.py1
-rw-r--r--Lib/test/test_import.py1
-rw-r--r--Lib/test/test_pdb.py1
-rw-r--r--Lib/test/test_posix.py21
-rw-r--r--Lib/test/test_source_encoding.py3
-rw-r--r--Lib/test/test_support.py1
-rw-r--r--Lib/test/test_threaded_import.py4
7 files changed, 20 insertions, 12 deletions
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 024f438..80b9ec3 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -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__)
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index 781a159..b4842c5 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -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)
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 895be02..edc9e75 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -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,
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index d9acfa4..f37f2de 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1124,18 +1124,19 @@ 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 is None:
+ continue
- if function:
- for dst in ("noodly2", support.TESTFN):
- try:
- function('doesnotexistfilename', dst)
- except OSError as e:
- self.assertIn("'doesnotexistfilename' -> '{}'".format(dst), str(e))
- break
- else:
- self.fail("No valid path_error2() test for os." + name)
+ for dst in ("noodly2", support.TESTFN):
+ try:
+ function('doesnotexistfilename', dst)
+ except OSError as e:
+ self.assertIn("'doesnotexistfilename' -> '{}'".format(dst), str(e))
+ break
+ else:
+ self.fail("No valid path_error2() test for os." + name)
class PosixGroupsTester(unittest.TestCase):
diff --git a/Lib/test/test_source_encoding.py b/Lib/test/test_source_encoding.py
index 0c41e50..39a7c56 100644
--- 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 @@ 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
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 212c9f3..a02d2f4 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -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()
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py
index 854cdf9..5bf670c 100644
--- a/Lib/test/test_threaded_import.py
+++ b/Lib/test/test_threaded_import.py
@@ -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):
@@ -228,6 +229,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)