mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
Issue #9517: Move script_helper to the support package.
Patch by Christie Wilson.
This commit is contained in:
parent
025e9ebd0a
commit
ce643913a9
45 changed files with 115 additions and 102 deletions
|
@ -13,10 +13,9 @@ import os
|
|||
import os.path
|
||||
import py_compile
|
||||
|
||||
from test.script_helper import (
|
||||
from test.support.script_helper import (
|
||||
make_pkg, make_script, make_zip_pkg, make_zip_script,
|
||||
assert_python_ok, assert_python_failure, temp_dir,
|
||||
spawn_python, kill_python)
|
||||
assert_python_ok, assert_python_failure, spawn_python, kill_python)
|
||||
|
||||
# Look up which start methods are available to test
|
||||
import multiprocessing
|
||||
|
@ -157,12 +156,12 @@ class MultiProcessingCmdLineMixin():
|
|||
self._check_output(script_name, rc, out, err)
|
||||
|
||||
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')
|
||||
self._check_script(script_name)
|
||||
|
||||
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',
|
||||
omit_suffix=True)
|
||||
self._check_script(script_name)
|
||||
|
@ -173,7 +172,7 @@ class MultiProcessingCmdLineMixin():
|
|||
# a workaround for that case
|
||||
# See https://github.com/ipython/ipython/issues/4698
|
||||
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',
|
||||
source=source)
|
||||
self._check_script(script_name)
|
||||
|
@ -183,7 +182,7 @@ class MultiProcessingCmdLineMixin():
|
|||
self._check_script(script_no_suffix)
|
||||
|
||||
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')
|
||||
py_compile.compile(script_name, doraise=True)
|
||||
os.remove(script_name)
|
||||
|
@ -192,14 +191,14 @@ class MultiProcessingCmdLineMixin():
|
|||
|
||||
def test_directory(self):
|
||||
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__',
|
||||
source=source)
|
||||
self._check_script(script_dir)
|
||||
|
||||
def test_directory_compiled(self):
|
||||
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__',
|
||||
source=source)
|
||||
py_compile.compile(script_name, doraise=True)
|
||||
|
@ -209,7 +208,7 @@ class MultiProcessingCmdLineMixin():
|
|||
|
||||
def test_zipfile(self):
|
||||
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__',
|
||||
source=source)
|
||||
zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
|
||||
|
@ -217,7 +216,7 @@ class MultiProcessingCmdLineMixin():
|
|||
|
||||
def test_zipfile_compiled(self):
|
||||
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__',
|
||||
source=source)
|
||||
compiled_name = py_compile.compile(script_name, doraise=True)
|
||||
|
@ -225,7 +224,7 @@ class MultiProcessingCmdLineMixin():
|
|||
self._check_script(zip_name)
|
||||
|
||||
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')
|
||||
make_pkg(pkg_dir)
|
||||
script_name = _make_test_script(pkg_dir, 'check_sibling')
|
||||
|
@ -234,20 +233,20 @@ class MultiProcessingCmdLineMixin():
|
|||
self._check_script(launch_name)
|
||||
|
||||
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')
|
||||
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.script', zip_name)
|
||||
self._check_script(launch_name)
|
||||
|
||||
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)
|
||||
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.test_pkg.script', zip_name)
|
||||
self._check_script(launch_name)
|
||||
|
||||
def test_package(self):
|
||||
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')
|
||||
make_pkg(pkg_dir)
|
||||
script_name = _make_test_script(pkg_dir, '__main__',
|
||||
|
@ -257,7 +256,7 @@ class MultiProcessingCmdLineMixin():
|
|||
|
||||
def test_package_compiled(self):
|
||||
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')
|
||||
make_pkg(pkg_dir)
|
||||
script_name = _make_test_script(pkg_dir, '__main__',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue