mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Merge 3.4
This commit is contained in:
commit
d577cea8ab
7 changed files with 20 additions and 12 deletions
|
@ -198,6 +198,7 @@ class ImportTests(unittest.TestCase):
|
||||||
support.unlink(temp_mod_name + ext)
|
support.unlink(temp_mod_name + ext)
|
||||||
support.unlink(init_file_name + ext)
|
support.unlink(init_file_name + ext)
|
||||||
support.rmtree(test_package_name)
|
support.rmtree(test_package_name)
|
||||||
|
support.rmtree('__pycache__')
|
||||||
|
|
||||||
def test_issue9319(self):
|
def test_issue9319(self):
|
||||||
path = os.path.dirname(__file__)
|
path = os.path.dirname(__file__)
|
||||||
|
|
|
@ -1062,6 +1062,7 @@ class ImportTracebackTests(unittest.TestCase):
|
||||||
# Issue #11619: The Python parser and the import machinery must not
|
# Issue #11619: The Python parser and the import machinery must not
|
||||||
# encode filenames, especially on Windows
|
# encode filenames, especially on Windows
|
||||||
pyname = script_helper.make_script('', TESTFN_UNENCODABLE, 'pass')
|
pyname = script_helper.make_script('', TESTFN_UNENCODABLE, 'pass')
|
||||||
|
self.addCleanup(unlink, pyname)
|
||||||
name = pyname[:-3]
|
name = pyname[:-3]
|
||||||
script_helper.assert_python_ok("-c", "mod = __import__(%a)" % name,
|
script_helper.assert_python_ok("-c", "mod = __import__(%a)" % name,
|
||||||
__isolated=False)
|
__isolated=False)
|
||||||
|
|
|
@ -916,6 +916,7 @@ class PdbTestCase(unittest.TestCase):
|
||||||
with open(filename, 'w') as f:
|
with open(filename, 'w') as f:
|
||||||
f.write(textwrap.dedent(script))
|
f.write(textwrap.dedent(script))
|
||||||
self.addCleanup(support.unlink, filename)
|
self.addCleanup(support.unlink, filename)
|
||||||
|
self.addCleanup(support.rmtree, '__pycache__')
|
||||||
cmd = [sys.executable, '-m', 'pdb', filename]
|
cmd = [sys.executable, '-m', 'pdb', filename]
|
||||||
stdout = stderr = None
|
stdout = stderr = None
|
||||||
with subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
with subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
||||||
|
|
|
@ -1124,18 +1124,19 @@ class PosixTester(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
Test functions that call path_error2(), providing two filenames in their exceptions.
|
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)
|
function = getattr(os, name, None)
|
||||||
|
if function is None:
|
||||||
|
continue
|
||||||
|
|
||||||
if function:
|
for dst in ("noodly2", support.TESTFN):
|
||||||
for dst in ("noodly2", support.TESTFN):
|
try:
|
||||||
try:
|
function('doesnotexistfilename', dst)
|
||||||
function('doesnotexistfilename', dst)
|
except OSError as e:
|
||||||
except OSError as e:
|
self.assertIn("'doesnotexistfilename' -> '{}'".format(dst), str(e))
|
||||||
self.assertIn("'doesnotexistfilename' -> '{}'".format(dst), str(e))
|
break
|
||||||
break
|
else:
|
||||||
else:
|
self.fail("No valid path_error2() test for os." + name)
|
||||||
self.fail("No valid path_error2() test for os." + name)
|
|
||||||
|
|
||||||
class PosixGroupsTester(unittest.TestCase):
|
class PosixGroupsTester(unittest.TestCase):
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: koi8-r -*-
|
# -*- coding: koi8-r -*-
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import TESTFN, unlink, unload
|
from test.support import TESTFN, unlink, unload, rmtree
|
||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -129,6 +129,7 @@ class SourceEncodingTest(unittest.TestCase):
|
||||||
unlink(filename + "c")
|
unlink(filename + "c")
|
||||||
unlink(filename + "o")
|
unlink(filename + "o")
|
||||||
unload(TESTFN)
|
unload(TESTFN)
|
||||||
|
rmtree('__pycache__')
|
||||||
|
|
||||||
def test_error_from_string(self):
|
def test_error_from_string(self):
|
||||||
# See http://bugs.python.org/issue6289
|
# See http://bugs.python.org/issue6289
|
||||||
|
|
|
@ -69,6 +69,7 @@ class TestSupport(unittest.TestCase):
|
||||||
finally:
|
finally:
|
||||||
del sys.path[0]
|
del sys.path[0]
|
||||||
support.unlink(mod_filename)
|
support.unlink(mod_filename)
|
||||||
|
support.rmtree('__pycache__')
|
||||||
|
|
||||||
def test_HOST(self):
|
def test_HOST(self):
|
||||||
s = socket.socket()
|
s = socket.socket()
|
||||||
|
|
|
@ -13,7 +13,8 @@ import time
|
||||||
import shutil
|
import shutil
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import (
|
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')
|
threading = import_module('threading')
|
||||||
|
|
||||||
def task(N, done, done_tasks, errors):
|
def task(N, done, done_tasks, errors):
|
||||||
|
@ -228,6 +229,7 @@ class ThreadedImportTests(unittest.TestCase):
|
||||||
f.write(code.encode('utf-8'))
|
f.write(code.encode('utf-8'))
|
||||||
self.addCleanup(unlink, filename)
|
self.addCleanup(unlink, filename)
|
||||||
self.addCleanup(forget, TESTFN)
|
self.addCleanup(forget, TESTFN)
|
||||||
|
self.addCleanup(rmtree, '__pycache__')
|
||||||
importlib.invalidate_caches()
|
importlib.invalidate_caches()
|
||||||
__import__(TESTFN)
|
__import__(TESTFN)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue