mirror of https://github.com/python/cpython
Merge heads.
This commit is contained in:
commit
c4c59050c8
|
@ -16,7 +16,7 @@ from asyncio import constants
|
||||||
from asyncio import test_utils
|
from asyncio import test_utils
|
||||||
try:
|
try:
|
||||||
from test import support
|
from test import support
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from asyncio import test_support as support
|
from asyncio import test_support as support
|
||||||
from asyncio.test_support import assert_python_ok
|
from asyncio.test_support import assert_python_ok
|
||||||
|
|
|
@ -15,7 +15,7 @@ from asyncio import coroutines
|
||||||
from asyncio import test_utils
|
from asyncio import test_utils
|
||||||
try:
|
try:
|
||||||
from test import support
|
from test import support
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from asyncio import test_support as support
|
from asyncio import test_support as support
|
||||||
from asyncio.test_support import assert_python_ok
|
from asyncio.test_support import assert_python_ok
|
||||||
|
|
|
@ -16,7 +16,7 @@ import unittest
|
||||||
import warnings
|
import warnings
|
||||||
from operator import neg
|
from operator import neg
|
||||||
from test.support import TESTFN, unlink, run_unittest, check_warnings
|
from test.support import TESTFN, unlink, run_unittest, check_warnings
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
try:
|
try:
|
||||||
import pty, signal
|
import pty, signal
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -2,7 +2,7 @@ import calendar
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from test import support
|
from test import support
|
||||||
from test.script_helper import assert_python_ok, assert_python_failure
|
from test.support.script_helper import assert_python_ok, assert_python_failure
|
||||||
import time
|
import time
|
||||||
import locale
|
import locale
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -11,7 +11,7 @@ import time
|
||||||
import unittest
|
import unittest
|
||||||
from test import support
|
from test import support
|
||||||
from test.support import MISSING_C_DOCSTRINGS
|
from test.support import MISSING_C_DOCSTRINGS
|
||||||
from test.script_helper import assert_python_failure
|
from test.support.script_helper import assert_python_failure
|
||||||
try:
|
try:
|
||||||
import _posixsubprocess
|
import _posixsubprocess
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from test.script_helper import assert_python_failure, temp_dir
|
from test.support import temp_dir
|
||||||
|
from test.support.script_helper import assert_python_failure
|
||||||
import unittest
|
import unittest
|
||||||
import sys
|
import sys
|
||||||
import cgitb
|
import cgitb
|
||||||
|
|
|
@ -8,8 +8,8 @@ import shutil
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
from test import script_helper
|
from test.support import script_helper
|
||||||
from test.script_helper import (spawn_python, kill_python, assert_python_ok,
|
from test.support.script_helper import (spawn_python, kill_python, assert_python_ok,
|
||||||
assert_python_failure)
|
assert_python_failure)
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_xoptions(self):
|
def test_xoptions(self):
|
||||||
def get_xoptions(*args):
|
def get_xoptions(*args):
|
||||||
# use subprocess module directly because test.script_helper adds
|
# use subprocess module directly because test.support.script_helper adds
|
||||||
# "-X faulthandler" to the command line
|
# "-X faulthandler" to the command line
|
||||||
args = (sys.executable, '-E') + args
|
args = (sys.executable, '-E') + args
|
||||||
args += ('-c', 'import sys; print(sys._xoptions)')
|
args += ('-c', 'import sys; print(sys._xoptions)')
|
||||||
|
|
|
@ -13,10 +13,9 @@ import subprocess
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
from test import support
|
from test import support
|
||||||
from test.script_helper import (
|
from test.support.script_helper import (
|
||||||
make_pkg, make_script, make_zip_pkg, make_zip_script,
|
make_pkg, make_script, make_zip_pkg, make_zip_script,
|
||||||
assert_python_ok, assert_python_failure, temp_dir,
|
assert_python_ok, assert_python_failure, spawn_python, kill_python)
|
||||||
spawn_python, kill_python)
|
|
||||||
|
|
||||||
verbose = support.verbose
|
verbose = support.verbose
|
||||||
|
|
||||||
|
@ -223,14 +222,14 @@ class CmdLineTest(unittest.TestCase):
|
||||||
self.check_repl_stderr_flush(True)
|
self.check_repl_stderr_flush(True)
|
||||||
|
|
||||||
def test_basic_script(self):
|
def test_basic_script(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, 'script')
|
script_name = _make_test_script(script_dir, 'script')
|
||||||
self._check_script(script_name, script_name, script_name,
|
self._check_script(script_name, script_name, script_name,
|
||||||
script_dir, None,
|
script_dir, None,
|
||||||
importlib.machinery.SourceFileLoader)
|
importlib.machinery.SourceFileLoader)
|
||||||
|
|
||||||
def test_script_compiled(self):
|
def test_script_compiled(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, 'script')
|
script_name = _make_test_script(script_dir, 'script')
|
||||||
py_compile.compile(script_name, doraise=True)
|
py_compile.compile(script_name, doraise=True)
|
||||||
os.remove(script_name)
|
os.remove(script_name)
|
||||||
|
@ -240,14 +239,14 @@ class CmdLineTest(unittest.TestCase):
|
||||||
importlib.machinery.SourcelessFileLoader)
|
importlib.machinery.SourcelessFileLoader)
|
||||||
|
|
||||||
def test_directory(self):
|
def test_directory(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, '__main__')
|
script_name = _make_test_script(script_dir, '__main__')
|
||||||
self._check_script(script_dir, script_name, script_dir,
|
self._check_script(script_dir, script_name, script_dir,
|
||||||
script_dir, '',
|
script_dir, '',
|
||||||
importlib.machinery.SourceFileLoader)
|
importlib.machinery.SourceFileLoader)
|
||||||
|
|
||||||
def test_directory_compiled(self):
|
def test_directory_compiled(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, '__main__')
|
script_name = _make_test_script(script_dir, '__main__')
|
||||||
py_compile.compile(script_name, doraise=True)
|
py_compile.compile(script_name, doraise=True)
|
||||||
os.remove(script_name)
|
os.remove(script_name)
|
||||||
|
@ -257,19 +256,19 @@ class CmdLineTest(unittest.TestCase):
|
||||||
importlib.machinery.SourcelessFileLoader)
|
importlib.machinery.SourcelessFileLoader)
|
||||||
|
|
||||||
def test_directory_error(self):
|
def test_directory_error(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
msg = "can't find '__main__' module in %r" % script_dir
|
msg = "can't find '__main__' module in %r" % script_dir
|
||||||
self._check_import_error(script_dir, msg)
|
self._check_import_error(script_dir, msg)
|
||||||
|
|
||||||
def test_zipfile(self):
|
def test_zipfile(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, '__main__')
|
script_name = _make_test_script(script_dir, '__main__')
|
||||||
zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
|
zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
|
||||||
self._check_script(zip_name, run_name, zip_name, zip_name, '',
|
self._check_script(zip_name, run_name, zip_name, zip_name, '',
|
||||||
zipimport.zipimporter)
|
zipimport.zipimporter)
|
||||||
|
|
||||||
def test_zipfile_compiled(self):
|
def test_zipfile_compiled(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, '__main__')
|
script_name = _make_test_script(script_dir, '__main__')
|
||||||
compiled_name = py_compile.compile(script_name, doraise=True)
|
compiled_name = py_compile.compile(script_name, doraise=True)
|
||||||
zip_name, run_name = make_zip_script(script_dir, 'test_zip', compiled_name)
|
zip_name, run_name = make_zip_script(script_dir, 'test_zip', compiled_name)
|
||||||
|
@ -277,14 +276,14 @@ class CmdLineTest(unittest.TestCase):
|
||||||
zipimport.zipimporter)
|
zipimport.zipimporter)
|
||||||
|
|
||||||
def test_zipfile_error(self):
|
def test_zipfile_error(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, 'not_main')
|
script_name = _make_test_script(script_dir, 'not_main')
|
||||||
zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
|
zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
|
||||||
msg = "can't find '__main__' module in %r" % zip_name
|
msg = "can't find '__main__' module in %r" % zip_name
|
||||||
self._check_import_error(zip_name, msg)
|
self._check_import_error(zip_name, msg)
|
||||||
|
|
||||||
def test_module_in_package(self):
|
def test_module_in_package(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
||||||
make_pkg(pkg_dir)
|
make_pkg(pkg_dir)
|
||||||
script_name = _make_test_script(pkg_dir, 'script')
|
script_name = _make_test_script(pkg_dir, 'script')
|
||||||
|
@ -294,14 +293,14 @@ class CmdLineTest(unittest.TestCase):
|
||||||
importlib.machinery.SourceFileLoader)
|
importlib.machinery.SourceFileLoader)
|
||||||
|
|
||||||
def test_module_in_package_in_zipfile(self):
|
def test_module_in_package_in_zipfile(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script')
|
zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script')
|
||||||
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.script', zip_name)
|
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.script', zip_name)
|
||||||
self._check_script(launch_name, run_name, run_name,
|
self._check_script(launch_name, run_name, run_name,
|
||||||
zip_name, 'test_pkg', zipimport.zipimporter)
|
zip_name, 'test_pkg', zipimport.zipimporter)
|
||||||
|
|
||||||
def test_module_in_subpackage_in_zipfile(self):
|
def test_module_in_subpackage_in_zipfile(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script', depth=2)
|
zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script', depth=2)
|
||||||
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.test_pkg.script', zip_name)
|
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.test_pkg.script', zip_name)
|
||||||
self._check_script(launch_name, run_name, run_name,
|
self._check_script(launch_name, run_name, run_name,
|
||||||
|
@ -309,7 +308,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
zipimport.zipimporter)
|
zipimport.zipimporter)
|
||||||
|
|
||||||
def test_package(self):
|
def test_package(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
||||||
make_pkg(pkg_dir)
|
make_pkg(pkg_dir)
|
||||||
script_name = _make_test_script(pkg_dir, '__main__')
|
script_name = _make_test_script(pkg_dir, '__main__')
|
||||||
|
@ -319,7 +318,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
importlib.machinery.SourceFileLoader)
|
importlib.machinery.SourceFileLoader)
|
||||||
|
|
||||||
def test_package_compiled(self):
|
def test_package_compiled(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
||||||
make_pkg(pkg_dir)
|
make_pkg(pkg_dir)
|
||||||
script_name = _make_test_script(pkg_dir, '__main__')
|
script_name = _make_test_script(pkg_dir, '__main__')
|
||||||
|
@ -332,7 +331,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
importlib.machinery.SourcelessFileLoader)
|
importlib.machinery.SourcelessFileLoader)
|
||||||
|
|
||||||
def test_package_error(self):
|
def test_package_error(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
||||||
make_pkg(pkg_dir)
|
make_pkg(pkg_dir)
|
||||||
msg = ("'test_pkg' is a package and cannot "
|
msg = ("'test_pkg' is a package and cannot "
|
||||||
|
@ -341,7 +340,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
self._check_import_error(launch_name, msg)
|
self._check_import_error(launch_name, msg)
|
||||||
|
|
||||||
def test_package_recursion(self):
|
def test_package_recursion(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
||||||
make_pkg(pkg_dir)
|
make_pkg(pkg_dir)
|
||||||
main_dir = os.path.join(pkg_dir, '__main__')
|
main_dir = os.path.join(pkg_dir, '__main__')
|
||||||
|
@ -355,7 +354,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
def test_issue8202(self):
|
def test_issue8202(self):
|
||||||
# Make sure package __init__ modules see "-m" in sys.argv0 while
|
# Make sure package __init__ modules see "-m" in sys.argv0 while
|
||||||
# searching for the module to execute
|
# searching for the module to execute
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
with support.change_cwd(path=script_dir):
|
with support.change_cwd(path=script_dir):
|
||||||
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
||||||
make_pkg(pkg_dir, "import sys; print('init_argv0==%r' % sys.argv[0])")
|
make_pkg(pkg_dir, "import sys; print('init_argv0==%r' % sys.argv[0])")
|
||||||
|
@ -372,7 +371,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
def test_issue8202_dash_c_file_ignored(self):
|
def test_issue8202_dash_c_file_ignored(self):
|
||||||
# Make sure a "-c" file in the current directory
|
# Make sure a "-c" file in the current directory
|
||||||
# does not alter the value of sys.path[0]
|
# does not alter the value of sys.path[0]
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
with support.change_cwd(path=script_dir):
|
with support.change_cwd(path=script_dir):
|
||||||
with open("-c", "w") as f:
|
with open("-c", "w") as f:
|
||||||
f.write("data")
|
f.write("data")
|
||||||
|
@ -387,7 +386,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
def test_issue8202_dash_m_file_ignored(self):
|
def test_issue8202_dash_m_file_ignored(self):
|
||||||
# Make sure a "-m" file in the current directory
|
# Make sure a "-m" file in the current directory
|
||||||
# does not alter the value of sys.path[0]
|
# does not alter the value of sys.path[0]
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, 'other')
|
script_name = _make_test_script(script_dir, 'other')
|
||||||
with support.change_cwd(path=script_dir):
|
with support.change_cwd(path=script_dir):
|
||||||
with open("-m", "w") as f:
|
with open("-m", "w") as f:
|
||||||
|
@ -402,7 +401,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
# If a module is invoked with the -m command line flag
|
# If a module is invoked with the -m command line flag
|
||||||
# and results in an error that the return code to the
|
# and results in an error that the return code to the
|
||||||
# shell is '1'
|
# shell is '1'
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
with support.change_cwd(path=script_dir):
|
with support.change_cwd(path=script_dir):
|
||||||
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
||||||
make_pkg(pkg_dir)
|
make_pkg(pkg_dir)
|
||||||
|
@ -422,7 +421,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
except:
|
except:
|
||||||
raise NameError from None
|
raise NameError from None
|
||||||
""")
|
""")
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, 'script', script)
|
script_name = _make_test_script(script_dir, 'script', script)
|
||||||
exitcode, stdout, stderr = assert_python_failure(script_name)
|
exitcode, stdout, stderr = assert_python_failure(script_name)
|
||||||
text = stderr.decode('ascii').split('\n')
|
text = stderr.decode('ascii').split('\n')
|
||||||
|
@ -466,7 +465,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
if error:
|
if error:
|
||||||
sys.exit(error)
|
sys.exit(error)
|
||||||
""")
|
""")
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, 'script', script)
|
script_name = _make_test_script(script_dir, 'script', script)
|
||||||
exitcode, stdout, stderr = assert_python_failure(script_name)
|
exitcode, stdout, stderr = assert_python_failure(script_name)
|
||||||
text = stderr.decode('ascii')
|
text = stderr.decode('ascii')
|
||||||
|
|
|
@ -17,7 +17,8 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_have_multiprocessing = False
|
_have_multiprocessing = False
|
||||||
|
|
||||||
from test import support, script_helper
|
from test import support
|
||||||
|
from test.support import script_helper
|
||||||
|
|
||||||
class CompileallTests(unittest.TestCase):
|
class CompileallTests(unittest.TestCase):
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ test.support.import_module('multiprocessing.synchronize')
|
||||||
# without thread support.
|
# without thread support.
|
||||||
test.support.import_module('threading')
|
test.support.import_module('threading')
|
||||||
|
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -8,7 +8,7 @@ import unittest
|
||||||
import glob
|
import glob
|
||||||
import os.path
|
import os.path
|
||||||
import test.support
|
import test.support
|
||||||
from test.script_helper import assert_python_failure
|
from test.support.script_helper import assert_python_failure
|
||||||
|
|
||||||
CRASHER_DIR = os.path.join(os.path.dirname(__file__), "crashers")
|
CRASHER_DIR = os.path.join(os.path.dirname(__file__), "crashers")
|
||||||
CRASHER_FILES = os.path.join(CRASHER_DIR, "*.py")
|
CRASHER_FILES = os.path.join(CRASHER_DIR, "*.py")
|
||||||
|
|
|
@ -2729,8 +2729,8 @@ With those preliminaries out of the way, we'll start with a file with two
|
||||||
simple tests and no errors. We'll run both the unadorned doctest command, and
|
simple tests and no errors. We'll run both the unadorned doctest command, and
|
||||||
the verbose version, and then check the output:
|
the verbose version, and then check the output:
|
||||||
|
|
||||||
>>> from test import script_helper
|
>>> from test.support import script_helper, temp_dir
|
||||||
>>> with script_helper.temp_dir() as tmpdir:
|
>>> with temp_dir() as tmpdir:
|
||||||
... fn = os.path.join(tmpdir, 'myfile.doc')
|
... fn = os.path.join(tmpdir, 'myfile.doc')
|
||||||
... with open(fn, 'w') as f:
|
... with open(fn, 'w') as f:
|
||||||
... _ = f.write('This is a very simple test file.\n')
|
... _ = f.write('This is a very simple test file.\n')
|
||||||
|
@ -2780,8 +2780,8 @@ ability to process more than one file on the command line and, since the second
|
||||||
file ends in '.py', its handling of python module files (as opposed to straight
|
file ends in '.py', its handling of python module files (as opposed to straight
|
||||||
text files).
|
text files).
|
||||||
|
|
||||||
>>> from test import script_helper
|
>>> from test.support import script_helper, temp_dir
|
||||||
>>> with script_helper.temp_dir() as tmpdir:
|
>>> with temp_dir() as tmpdir:
|
||||||
... fn = os.path.join(tmpdir, 'myfile.doc')
|
... fn = os.path.join(tmpdir, 'myfile.doc')
|
||||||
... with open(fn, 'w') as f:
|
... with open(fn, 'w') as f:
|
||||||
... _ = f.write('This is another simple test file.\n')
|
... _ = f.write('This is another simple test file.\n')
|
||||||
|
|
|
@ -2,7 +2,8 @@ import os
|
||||||
import signal
|
import signal
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from test import script_helper, support
|
from test import support
|
||||||
|
from test.support import script_helper
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(os.name == "posix", "only supported on Unix")
|
@unittest.skipUnless(os.name == "posix", "only supported on Unix")
|
||||||
|
|
|
@ -6,8 +6,8 @@ import re
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from test import support, script_helper
|
from test import support
|
||||||
from test.script_helper import assert_python_ok
|
from test.support import script_helper
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import (verbose, refcount_test, run_unittest,
|
from test.support import (verbose, refcount_test, run_unittest,
|
||||||
strip_python_stderr, cpython_only, start_threads)
|
strip_python_stderr, cpython_only, start_threads,
|
||||||
from test.script_helper import assert_python_ok, make_script, temp_dir
|
temp_dir)
|
||||||
|
from test.support.script_helper import assert_python_ok, make_script
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
|
@ -7,7 +7,7 @@ import datetime
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
from collections import Hashable
|
from collections import Hashable
|
||||||
|
|
||||||
IS_64BIT = sys.maxsize > 2**32
|
IS_64BIT = sys.maxsize > 2**32
|
||||||
|
|
|
@ -21,8 +21,9 @@ import test.support
|
||||||
from test.support import (
|
from test.support import (
|
||||||
EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython,
|
EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython,
|
||||||
make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask,
|
make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask,
|
||||||
unlink, unload, create_empty_file, cpython_only, TESTFN_UNENCODABLE)
|
unlink, unload, create_empty_file, cpython_only, TESTFN_UNENCODABLE,
|
||||||
from test import script_helper
|
temp_dir)
|
||||||
|
from test.support import script_helper
|
||||||
|
|
||||||
|
|
||||||
skip_if_dont_write_bytecode = unittest.skipIf(
|
skip_if_dont_write_bytecode = unittest.skipIf(
|
||||||
|
@ -45,7 +46,7 @@ def _ready_to_import(name=None, source=""):
|
||||||
# temporarily clears the module from sys.modules (if any)
|
# temporarily clears the module from sys.modules (if any)
|
||||||
# reverts or removes the module when cleaning up
|
# reverts or removes the module when cleaning up
|
||||||
name = name or "spam"
|
name = name or "spam"
|
||||||
with script_helper.temp_dir() as tempdir:
|
with temp_dir() as tempdir:
|
||||||
path = script_helper.make_script(tempdir, name, source)
|
path = script_helper.make_script(tempdir, name, source)
|
||||||
old_module = sys.modules.pop(name, None)
|
old_module = sys.modules.pop(name, None)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -26,7 +26,7 @@ except ImportError:
|
||||||
|
|
||||||
from test.support import run_unittest, TESTFN, DirsOnSysPath, cpython_only
|
from test.support import run_unittest, TESTFN, DirsOnSysPath, cpython_only
|
||||||
from test.support import MISSING_C_DOCSTRINGS, cpython_only
|
from test.support import MISSING_C_DOCSTRINGS, cpython_only
|
||||||
from test.script_helper import assert_python_ok, assert_python_failure
|
from test.support.script_helper import assert_python_ok, assert_python_failure
|
||||||
from test import inspect_fodder as mod
|
from test import inspect_fodder as mod
|
||||||
from test import inspect_fodder2 as mod2
|
from test import inspect_fodder2 as mod2
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import weakref
|
||||||
from collections import deque, UserList
|
from collections import deque, UserList
|
||||||
from itertools import cycle, count
|
from itertools import cycle, count
|
||||||
from test import support
|
from test import support
|
||||||
from test.script_helper import assert_python_ok, run_python_until_end
|
from test.support.script_helper import assert_python_ok, run_python_until_end
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
import io # C implementation of io
|
import io # C implementation of io
|
||||||
|
|
|
@ -4,7 +4,7 @@ import textwrap
|
||||||
import unittest
|
import unittest
|
||||||
import subprocess
|
import subprocess
|
||||||
from test import support
|
from test import support
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
|
|
||||||
|
|
||||||
class TestTool(unittest.TestCase):
|
class TestTool(unittest.TestCase):
|
||||||
|
|
|
@ -38,7 +38,7 @@ import socket
|
||||||
import struct
|
import struct
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
from test import support
|
from test import support
|
||||||
import textwrap
|
import textwrap
|
||||||
import time
|
import time
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import unittest
|
import unittest
|
||||||
import weakref
|
import weakref
|
||||||
from test.support import gc_collect
|
from test.support import gc_collect
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
ModuleType = type(sys)
|
ModuleType = type(sys)
|
||||||
|
|
|
@ -13,10 +13,9 @@ import os
|
||||||
import os.path
|
import os.path
|
||||||
import py_compile
|
import py_compile
|
||||||
|
|
||||||
from test.script_helper import (
|
from test.support.script_helper import (
|
||||||
make_pkg, make_script, make_zip_pkg, make_zip_script,
|
make_pkg, make_script, make_zip_pkg, make_zip_script,
|
||||||
assert_python_ok, assert_python_failure, temp_dir,
|
assert_python_ok, assert_python_failure, spawn_python, kill_python)
|
||||||
spawn_python, kill_python)
|
|
||||||
|
|
||||||
# Look up which start methods are available to test
|
# Look up which start methods are available to test
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
@ -157,12 +156,12 @@ class MultiProcessingCmdLineMixin():
|
||||||
self._check_output(script_name, rc, out, err)
|
self._check_output(script_name, rc, out, err)
|
||||||
|
|
||||||
def test_basic_script(self):
|
def test_basic_script(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, 'script')
|
script_name = _make_test_script(script_dir, 'script')
|
||||||
self._check_script(script_name)
|
self._check_script(script_name)
|
||||||
|
|
||||||
def test_basic_script_no_suffix(self):
|
def test_basic_script_no_suffix(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, 'script',
|
script_name = _make_test_script(script_dir, 'script',
|
||||||
omit_suffix=True)
|
omit_suffix=True)
|
||||||
self._check_script(script_name)
|
self._check_script(script_name)
|
||||||
|
@ -173,7 +172,7 @@ class MultiProcessingCmdLineMixin():
|
||||||
# a workaround for that case
|
# a workaround for that case
|
||||||
# See https://github.com/ipython/ipython/issues/4698
|
# See https://github.com/ipython/ipython/issues/4698
|
||||||
source = test_source_main_skipped_in_children
|
source = test_source_main_skipped_in_children
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, 'ipython',
|
script_name = _make_test_script(script_dir, 'ipython',
|
||||||
source=source)
|
source=source)
|
||||||
self._check_script(script_name)
|
self._check_script(script_name)
|
||||||
|
@ -183,7 +182,7 @@ class MultiProcessingCmdLineMixin():
|
||||||
self._check_script(script_no_suffix)
|
self._check_script(script_no_suffix)
|
||||||
|
|
||||||
def test_script_compiled(self):
|
def test_script_compiled(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, 'script')
|
script_name = _make_test_script(script_dir, 'script')
|
||||||
py_compile.compile(script_name, doraise=True)
|
py_compile.compile(script_name, doraise=True)
|
||||||
os.remove(script_name)
|
os.remove(script_name)
|
||||||
|
@ -192,14 +191,14 @@ class MultiProcessingCmdLineMixin():
|
||||||
|
|
||||||
def test_directory(self):
|
def test_directory(self):
|
||||||
source = self.main_in_children_source
|
source = self.main_in_children_source
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, '__main__',
|
script_name = _make_test_script(script_dir, '__main__',
|
||||||
source=source)
|
source=source)
|
||||||
self._check_script(script_dir)
|
self._check_script(script_dir)
|
||||||
|
|
||||||
def test_directory_compiled(self):
|
def test_directory_compiled(self):
|
||||||
source = self.main_in_children_source
|
source = self.main_in_children_source
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, '__main__',
|
script_name = _make_test_script(script_dir, '__main__',
|
||||||
source=source)
|
source=source)
|
||||||
py_compile.compile(script_name, doraise=True)
|
py_compile.compile(script_name, doraise=True)
|
||||||
|
@ -209,7 +208,7 @@ class MultiProcessingCmdLineMixin():
|
||||||
|
|
||||||
def test_zipfile(self):
|
def test_zipfile(self):
|
||||||
source = self.main_in_children_source
|
source = self.main_in_children_source
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, '__main__',
|
script_name = _make_test_script(script_dir, '__main__',
|
||||||
source=source)
|
source=source)
|
||||||
zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
|
zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
|
||||||
|
@ -217,7 +216,7 @@ class MultiProcessingCmdLineMixin():
|
||||||
|
|
||||||
def test_zipfile_compiled(self):
|
def test_zipfile_compiled(self):
|
||||||
source = self.main_in_children_source
|
source = self.main_in_children_source
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
script_name = _make_test_script(script_dir, '__main__',
|
script_name = _make_test_script(script_dir, '__main__',
|
||||||
source=source)
|
source=source)
|
||||||
compiled_name = py_compile.compile(script_name, doraise=True)
|
compiled_name = py_compile.compile(script_name, doraise=True)
|
||||||
|
@ -225,7 +224,7 @@ class MultiProcessingCmdLineMixin():
|
||||||
self._check_script(zip_name)
|
self._check_script(zip_name)
|
||||||
|
|
||||||
def test_module_in_package(self):
|
def test_module_in_package(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
||||||
make_pkg(pkg_dir)
|
make_pkg(pkg_dir)
|
||||||
script_name = _make_test_script(pkg_dir, 'check_sibling')
|
script_name = _make_test_script(pkg_dir, 'check_sibling')
|
||||||
|
@ -234,20 +233,20 @@ class MultiProcessingCmdLineMixin():
|
||||||
self._check_script(launch_name)
|
self._check_script(launch_name)
|
||||||
|
|
||||||
def test_module_in_package_in_zipfile(self):
|
def test_module_in_package_in_zipfile(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script')
|
zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script')
|
||||||
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.script', zip_name)
|
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.script', zip_name)
|
||||||
self._check_script(launch_name)
|
self._check_script(launch_name)
|
||||||
|
|
||||||
def test_module_in_subpackage_in_zipfile(self):
|
def test_module_in_subpackage_in_zipfile(self):
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script', depth=2)
|
zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script', depth=2)
|
||||||
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.test_pkg.script', zip_name)
|
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.test_pkg.script', zip_name)
|
||||||
self._check_script(launch_name)
|
self._check_script(launch_name)
|
||||||
|
|
||||||
def test_package(self):
|
def test_package(self):
|
||||||
source = self.main_in_children_source
|
source = self.main_in_children_source
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
||||||
make_pkg(pkg_dir)
|
make_pkg(pkg_dir)
|
||||||
script_name = _make_test_script(pkg_dir, '__main__',
|
script_name = _make_test_script(pkg_dir, '__main__',
|
||||||
|
@ -257,7 +256,7 @@ class MultiProcessingCmdLineMixin():
|
||||||
|
|
||||||
def test_package_compiled(self):
|
def test_package_compiled(self):
|
||||||
source = self.main_in_children_source
|
source = self.main_in_children_source
|
||||||
with temp_dir() as script_dir:
|
with support.temp_dir() as script_dir:
|
||||||
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
pkg_dir = os.path.join(script_dir, 'test_pkg')
|
||||||
make_pkg(pkg_dir)
|
make_pkg(pkg_dir)
|
||||||
script_name = _make_test_script(pkg_dir, '__main__',
|
script_name = _make_test_script(pkg_dir, '__main__',
|
||||||
|
|
|
@ -64,7 +64,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
INT_MAX = PY_SSIZE_T_MAX = sys.maxsize
|
INT_MAX = PY_SSIZE_T_MAX = sys.maxsize
|
||||||
|
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
|
|
||||||
root_in_posix = False
|
root_in_posix = False
|
||||||
if hasattr(os, 'geteuid'):
|
if hasattr(os, 'geteuid'):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import sys
|
||||||
import operator
|
import operator
|
||||||
import struct
|
import struct
|
||||||
from test import support
|
from test import support
|
||||||
from test.script_helper import assert_python_failure
|
from test.support.script_helper import assert_python_failure
|
||||||
|
|
||||||
#
|
#
|
||||||
# First, we test that we can generate trees from valid source fragments,
|
# First, we test that we can generate trees from valid source fragments,
|
||||||
|
|
|
@ -21,7 +21,7 @@ import xml.etree
|
||||||
import textwrap
|
import textwrap
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
from test.support import (
|
from test.support import (
|
||||||
TESTFN, rmtree,
|
TESTFN, rmtree,
|
||||||
reap_children, reap_threads, captured_output, captured_stdout,
|
reap_children, reap_threads, captured_output, captured_stdout,
|
||||||
|
|
|
@ -5,7 +5,7 @@ import os
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import import_module, unlink
|
from test.support import import_module, unlink
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
|
|
||||||
# Skip tests if there is no readline module
|
# Skip tests if there is no readline module
|
||||||
readline = import_module('readline')
|
readline = import_module('readline')
|
||||||
|
|
|
@ -9,9 +9,9 @@ import importlib, importlib.machinery, importlib.util
|
||||||
import py_compile
|
import py_compile
|
||||||
from test.support import (
|
from test.support import (
|
||||||
forget, make_legacy_pyc, unload, verbose, no_tracing,
|
forget, make_legacy_pyc, unload, verbose, no_tracing,
|
||||||
create_empty_file)
|
create_empty_file, temp_dir)
|
||||||
from test.script_helper import (
|
from test.support.script_helper import (
|
||||||
make_pkg, make_script, make_zip_pkg, make_zip_script, temp_dir)
|
make_pkg, make_script, make_zip_pkg, make_zip_script)
|
||||||
|
|
||||||
|
|
||||||
import runpy
|
import runpy
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
"""Unittests for test.script_helper. Who tests the test helper?"""
|
"""Unittests for test.support.script_helper. Who tests the test helper?"""
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from test import script_helper
|
from test.support import script_helper
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import struct
|
||||||
import subprocess
|
import subprocess
|
||||||
import traceback
|
import traceback
|
||||||
import sys, os, time, errno
|
import sys, os, time, errno
|
||||||
from test.script_helper import assert_python_ok, spawn_python
|
from test.support.script_helper import assert_python_ok, spawn_python
|
||||||
try:
|
try:
|
||||||
import threading
|
import threading
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
from test import script_helper
|
from test.support import script_helper
|
||||||
from test import support
|
from test import support
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
@ -394,7 +394,7 @@ class ProcessTestCase(BaseTestCase):
|
||||||
python_dir, python_base = self._split_python_path()
|
python_dir, python_base = self._split_python_path()
|
||||||
abs_python = os.path.join(python_dir, python_base)
|
abs_python = os.path.join(python_dir, python_base)
|
||||||
rel_python = os.path.join(os.curdir, python_base)
|
rel_python = os.path.join(os.curdir, python_base)
|
||||||
with script_helper.temp_dir() as wrong_dir:
|
with support.temp_dir() as wrong_dir:
|
||||||
# Before calling with an absolute path, confirm that using a
|
# Before calling with an absolute path, confirm that using a
|
||||||
# relative path fails.
|
# relative path fails.
|
||||||
self.assertRaises(FileNotFoundError, subprocess.Popen,
|
self.assertRaises(FileNotFoundError, subprocess.Popen,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest, test.support
|
import unittest, test.support
|
||||||
from test.script_helper import assert_python_ok, assert_python_failure
|
from test.support.script_helper import assert_python_ok, assert_python_failure
|
||||||
import sys, io, os
|
import sys, io, os
|
||||||
import struct
|
import struct
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -708,7 +708,7 @@ class SysModuleTest(unittest.TestCase):
|
||||||
@test.support.cpython_only
|
@test.support.cpython_only
|
||||||
def test_debugmallocstats(self):
|
def test_debugmallocstats(self):
|
||||||
# Test sys._debugmallocstats()
|
# Test sys._debugmallocstats()
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
args = ['-c', 'import sys; sys._debugmallocstats()']
|
args = ['-c', 'import sys; sys._debugmallocstats()']
|
||||||
ret, out, err = assert_python_ok(*args)
|
ret, out, err = assert_python_ok(*args)
|
||||||
self.assertIn(b"free PyDictObjects", err)
|
self.assertIn(b"free PyDictObjects", err)
|
||||||
|
|
|
@ -8,7 +8,8 @@ import unittest
|
||||||
import unittest.mock
|
import unittest.mock
|
||||||
import tarfile
|
import tarfile
|
||||||
|
|
||||||
from test import support, script_helper
|
from test import support
|
||||||
|
from test.support import script_helper
|
||||||
|
|
||||||
# Check for our compression modules.
|
# Check for our compression modules.
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -12,7 +12,8 @@ import weakref
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test import support, script_helper
|
from test import support
|
||||||
|
from test.support import script_helper
|
||||||
|
|
||||||
|
|
||||||
if hasattr(os, 'stat'):
|
if hasattr(os, 'stat'):
|
||||||
|
|
|
@ -4,7 +4,7 @@ Tests for the threading module.
|
||||||
|
|
||||||
import test.support
|
import test.support
|
||||||
from test.support import verbose, strip_python_stderr, import_module, cpython_only
|
from test.support import verbose, strip_python_stderr, import_module, cpython_only
|
||||||
from test.script_helper import assert_python_ok, assert_python_failure
|
from test.support.script_helper import assert_python_ok, assert_python_failure
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
|
|
@ -4,7 +4,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from test import support
|
from test import support
|
||||||
from test.script_helper import assert_python_ok, assert_python_failure
|
from test.support.script_helper import assert_python_ok, assert_python_failure
|
||||||
|
|
||||||
from test.test_tools import scriptsdir, import_tool, skip_if_missing
|
from test.test_tools import scriptsdir, import_tool, skip_if_missing
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import unittest
|
||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
from test import support
|
from test import support
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
|
|
||||||
from test.test_tools import scriptsdir, skip_if_missing
|
from test.test_tools import scriptsdir, skip_if_missing
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ Tools directory of a Python checkout or tarball, such as reindent.py.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
|
|
||||||
from test.test_tools import scriptsdir, skip_if_missing
|
from test.test_tools import scriptsdir, skip_if_missing
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import unittest
|
||||||
import re
|
import re
|
||||||
from test import support
|
from test import support
|
||||||
from test.support import TESTFN, Error, captured_output, unlink, cpython_only
|
from test.support import TESTFN, Error, captured_output, unlink, cpython_only
|
||||||
from test.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
|
@ -4,8 +4,9 @@ import sys
|
||||||
import tracemalloc
|
import tracemalloc
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
from test.script_helper import assert_python_ok, assert_python_failure
|
from test.support.script_helper import (assert_python_ok, assert_python_failure,
|
||||||
from test import script_helper, support
|
interpreter_requires_environment)
|
||||||
|
from test import support
|
||||||
try:
|
try:
|
||||||
import threading
|
import threading
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -751,7 +752,7 @@ class TestCommandLine(unittest.TestCase):
|
||||||
stdout = stdout.rstrip()
|
stdout = stdout.rstrip()
|
||||||
self.assertEqual(stdout, b'False')
|
self.assertEqual(stdout, b'False')
|
||||||
|
|
||||||
@unittest.skipIf(script_helper.interpreter_requires_environment(),
|
@unittest.skipIf(interpreter_requires_environment(),
|
||||||
'Cannot run -E tests when PYTHON env vars are required.')
|
'Cannot run -E tests when PYTHON env vars are required.')
|
||||||
def test_env_var_ignored_with_E(self):
|
def test_env_var_ignored_with_E(self):
|
||||||
"""PYTHON* environment variables must be ignored when -E is present."""
|
"""PYTHON* environment variables must be ignored when -E is present."""
|
||||||
|
|
|
@ -5,7 +5,7 @@ from io import StringIO
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from test import support
|
from test import support
|
||||||
from test.script_helper import assert_python_ok, assert_python_failure
|
from test.support.script_helper import assert_python_ok, assert_python_failure
|
||||||
|
|
||||||
from test import warning_tests
|
from test import warning_tests
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ import operator
|
||||||
import contextlib
|
import contextlib
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from test import support, script_helper
|
from test import support
|
||||||
|
from test.support import script_helper
|
||||||
|
|
||||||
# Used in ReferencesTestCase.test_ref_created_during_del() .
|
# Used in ReferencesTestCase.test_ref_created_during_del() .
|
||||||
ref_from_del = None
|
ref_from_del = None
|
||||||
|
|
|
@ -14,8 +14,8 @@ import inspect
|
||||||
import linecache
|
import linecache
|
||||||
import pdb
|
import pdb
|
||||||
import unittest
|
import unittest
|
||||||
from test.script_helper import (spawn_python, kill_python, assert_python_ok,
|
from test.support.script_helper import (spawn_python, kill_python, assert_python_ok,
|
||||||
temp_dir, make_script, make_zip_script)
|
make_script, make_zip_script)
|
||||||
|
|
||||||
verbose = test.support.verbose
|
verbose = test.support.verbose
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class ZipSupportTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_inspect_getsource_issue4223(self):
|
def test_inspect_getsource_issue4223(self):
|
||||||
test_src = "def foo(): pass\n"
|
test_src = "def foo(): pass\n"
|
||||||
with temp_dir() as d:
|
with test.support.temp_dir() as d:
|
||||||
init_name = make_script(d, '__init__', test_src)
|
init_name = make_script(d, '__init__', test_src)
|
||||||
name_in_zip = os.path.join('zip_pkg',
|
name_in_zip = os.path.join('zip_pkg',
|
||||||
os.path.basename(init_name))
|
os.path.basename(init_name))
|
||||||
|
@ -118,7 +118,7 @@ class ZipSupportTests(unittest.TestCase):
|
||||||
mod_name = mod_name.replace("sample_", "sample_zipped_")
|
mod_name = mod_name.replace("sample_", "sample_zipped_")
|
||||||
sample_sources[mod_name] = src
|
sample_sources[mod_name] = src
|
||||||
|
|
||||||
with temp_dir() as d:
|
with test.support.temp_dir() as d:
|
||||||
script_name = make_script(d, 'test_zipped_doctest',
|
script_name = make_script(d, 'test_zipped_doctest',
|
||||||
test_src)
|
test_src)
|
||||||
zip_name, run_name = make_zip_script(d, 'test_zip',
|
zip_name, run_name = make_zip_script(d, 'test_zip',
|
||||||
|
@ -195,7 +195,7 @@ class ZipSupportTests(unittest.TestCase):
|
||||||
doctest.testmod()
|
doctest.testmod()
|
||||||
""")
|
""")
|
||||||
pattern = 'File "%s", line 2, in %s'
|
pattern = 'File "%s", line 2, in %s'
|
||||||
with temp_dir() as d:
|
with test.support.temp_dir() as d:
|
||||||
script_name = make_script(d, 'script', test_src)
|
script_name = make_script(d, 'script', test_src)
|
||||||
rc, out, err = assert_python_ok(script_name)
|
rc, out, err = assert_python_ok(script_name)
|
||||||
expected = pattern % (script_name, "__main__.Test")
|
expected = pattern % (script_name, "__main__.Test")
|
||||||
|
@ -222,7 +222,7 @@ class ZipSupportTests(unittest.TestCase):
|
||||||
import pdb
|
import pdb
|
||||||
pdb.Pdb(nosigint=True).runcall(f)
|
pdb.Pdb(nosigint=True).runcall(f)
|
||||||
""")
|
""")
|
||||||
with temp_dir() as d:
|
with test.support.temp_dir() as d:
|
||||||
script_name = make_script(d, 'script', test_src)
|
script_name = make_script(d, 'script', test_src)
|
||||||
p = spawn_python(script_name)
|
p = spawn_python(script_name)
|
||||||
p.stdin.write(b'l\n')
|
p.stdin.write(b'l\n')
|
||||||
|
|
|
@ -60,6 +60,12 @@ Library
|
||||||
- Issue #23887: urllib.error.HTTPError now has a proper repr() representation.
|
- Issue #23887: urllib.error.HTTPError now has a proper repr() representation.
|
||||||
Patch by Berker Peksag.
|
Patch by Berker Peksag.
|
||||||
|
|
||||||
|
Tests
|
||||||
|
-----
|
||||||
|
|
||||||
|
- Issue #9517: Move script_helper into the support package.
|
||||||
|
Patch by Christie Wilson.
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue