本文整理汇总了Python中test.script_helper.make_pkg函数的典型用法代码示例。如果您正苦于以下问题:Python make_pkg函数的具体用法?Python make_pkg怎么用?Python make_pkg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_pkg函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_module_in_package
def test_module_in_package(self):
with 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, 'script')
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.script')
self._check_script(launch_name, script_name, script_name, 'test_pkg')
开发者ID:EnviroCentre,项目名称:jython-upgrade,代码行数:7,代码来源:test_cmd_line_script.py
示例2: test_recursion_limit
def test_recursion_limit(self):
subpackage = os.path.join(self.pkgdir, 'spam')
subpackage2 = os.path.join(subpackage, 'ham')
subpackage3 = os.path.join(subpackage2, 'eggs')
for pkg in (subpackage, subpackage2, subpackage3):
script_helper.make_pkg(pkg)
subinitfn = os.path.join(subpackage, '__init__.py')
hamfn = script_helper.make_script(subpackage, 'ham', '')
spamfn = script_helper.make_script(subpackage2, 'spam', '')
eggfn = script_helper.make_script(subpackage3, 'egg', '')
self.assertRunOK('-q', '-r 0', self.pkgdir)
self.assertNotCompiled(subinitfn)
self.assertFalse(
os.path.exists(os.path.join(subpackage, '__pycache__')))
self.assertRunOK('-q', '-r 1', self.pkgdir)
self.assertCompiled(subinitfn)
self.assertCompiled(hamfn)
self.assertNotCompiled(spamfn)
self.assertRunOK('-q', '-r 2', self.pkgdir)
self.assertCompiled(subinitfn)
self.assertCompiled(hamfn)
self.assertCompiled(spamfn)
self.assertNotCompiled(eggfn)
self.assertRunOK('-q', '-r 5', self.pkgdir)
self.assertCompiled(subinitfn)
self.assertCompiled(hamfn)
self.assertCompiled(spamfn)
self.assertCompiled(eggfn)
开发者ID:Ian-Foote,项目名称:cpython,代码行数:33,代码来源:test_compileall.py
示例3: test_package
def test_package(self):
with 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__")
launch_name = _make_launch_script(script_dir, "launch", "test_pkg")
self._check_script(launch_name, script_name, script_name, "test_pkg")
开发者ID:hsienchieh,项目名称:uefilab,代码行数:7,代码来源:test_cmd_line_script.py
示例4: test_package_error
def test_package_error(self):
with temp_dir() as script_dir:
pkg_dir = os.path.join(script_dir, "test_pkg")
make_pkg(pkg_dir)
msg = "'test_pkg' is a package and cannot " "be directly executed"
launch_name = _make_launch_script(script_dir, "launch", "test_pkg")
self._check_import_error(launch_name, msg)
开发者ID:hsienchieh,项目名称:uefilab,代码行数:7,代码来源:test_cmd_line_script.py
示例5: test_package
def test_package(self):
source = self.main_in_children_source
with 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__',
source=source)
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg')
self._check_script(launch_name)
开发者ID:alex,项目名称:cpython,代码行数:9,代码来源:test_multiprocessing_main_handling.py
示例6: test_package
def test_package(self):
with 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__')
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg')
self._check_script(launch_name, script_name,
script_name, script_dir, 'test_pkg',
importlib.machinery.SourceFileLoader)
开发者ID:BeboPremo,项目名称:cpython,代码行数:9,代码来源:test_cmd_line_script.py
示例7: test_package_compiled
def test_package_compiled(self):
with 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__")
compiled_name = compile_script(script_name)
os.remove(script_name)
launch_name = _make_launch_script(script_dir, "launch", "test_pkg")
self._check_script(launch_name, compiled_name, compiled_name, "test_pkg")
开发者ID:hsienchieh,项目名称:uefilab,代码行数:9,代码来源:test_cmd_line_script.py
示例8: test_module_in_package
def test_module_in_package(self):
with 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, "script")
launch_name = _make_launch_script(script_dir, "launch", "test_pkg.script")
self._check_script(
launch_name, script_name, script_name, script_dir, "test_pkg", importlib.machinery.SourceFileLoader
)
开发者ID:GaloisInc,项目名称:echronos,代码行数:9,代码来源:test_cmd_line_script.py
示例9: test_package_recursion
def test_package_recursion(self):
with temp_dir() as script_dir:
pkg_dir = os.path.join(script_dir, 'test_pkg')
make_pkg(pkg_dir)
main_dir = os.path.join(pkg_dir, '__main__')
make_pkg(main_dir)
msg = ("Cannot use package as __main__ module; "
"'test_pkg' is a package and cannot "
"be directly executed")
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg')
self._check_import_error(launch_name, msg)
开发者ID:BeboPremo,项目名称:cpython,代码行数:11,代码来源:test_cmd_line_script.py
示例10: test_package_compiled
def test_package_compiled(self):
with 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__')
compiled_name = py_compile.compile(script_name, doraise=True)
os.remove(script_name)
pyc_file = support.make_legacy_pyc(script_name)
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg')
self._check_script(launch_name, pyc_file,
pyc_file, script_dir, 'test_pkg')
开发者ID:7modelsan,项目名称:kbengine,代码行数:11,代码来源:test_cmd_line_script.py
示例11: test_package_compiled
def test_package_compiled(self):
with 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__")
compiled_name = py_compile.compile(script_name, doraise=True)
os.remove(script_name)
pyc_file = support.make_legacy_pyc(script_name)
launch_name = _make_launch_script(script_dir, "launch", "test_pkg")
self._check_script(
launch_name, pyc_file, pyc_file, script_dir, "test_pkg", importlib.machinery.SourcelessFileLoader
)
开发者ID:GaloisInc,项目名称:echronos,代码行数:12,代码来源:test_cmd_line_script.py
示例12: test_dash_m_error_code_is_one
def test_dash_m_error_code_is_one(self):
# If a module is invoked with the -m command line flag
# and results in an error that the return code to the
# shell is '1'
with 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, 'other', "if __name__ == '__main__': raise ValueError")
rc, out, err = assert_python_failure('-m', 'test_pkg.other', *example_args)
if verbose > 1:
print(out)
self.assertEqual(rc, 1)
开发者ID:dr4ke616,项目名称:custom_python,代码行数:12,代码来源:test_cmd_line_script.py
示例13: test_package_compiled
def test_package_compiled(self):
if test.test_support.check_impl_detail(pypy=True):
raise unittest.SkipTest("pypy won't load lone .pyc files")
with 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__')
compiled_name = compile_script(script_name)
os.remove(script_name)
launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg')
self._check_script(launch_name, compiled_name,
compiled_name, 'test_pkg')
开发者ID:ArneBab,项目名称:pypyjs,代码行数:12,代码来源:test_cmd_line_script.py
示例14: test_issue8202
def test_issue8202(self):
# Make sure package __init__ modules see "-m" in sys.argv0 while
# searching for the module to execute
with temp_dir() as script_dir:
with support.temp_cwd(path=script_dir):
pkg_dir = os.path.join(script_dir, 'test_pkg')
make_pkg(pkg_dir, "import sys; print('init_argv0==%r' % sys.argv[0])")
script_name = _make_test_script(pkg_dir, 'script')
rc, out, err = assert_python_ok('-m', 'test_pkg.script', *example_args)
if verbose > 1:
print(out)
expected = "init_argv0==%r" % '-m'
self.assertIn(expected.encode('utf-8'), out)
self._check_output(script_name, rc, out,
script_name, script_name, '', 'test_pkg')
开发者ID:7modelsan,项目名称:kbengine,代码行数:15,代码来源:test_cmd_line_script.py
示例15: test_issue8202
def test_issue8202(self):
# Make sure package __init__ modules see "-m" in sys.argv0 while
# searching for the module to execute
with temp_dir() as script_dir:
with support.temp_cwd(path=script_dir):
pkg_dir = os.path.join(script_dir, "test_pkg")
make_pkg(pkg_dir, "import sys; print('init_argv0==%r' % sys.argv[0])")
script_name = _make_test_script(pkg_dir, "script")
rc, out, err = assert_python_ok("-m", "test_pkg.script", *example_args)
if verbose > 1:
print(out)
expected = "init_argv0==%r" % "-m"
self.assertIn(expected.encode("utf-8"), out)
self._check_output(
script_name, rc, out, script_name, script_name, "", "test_pkg", importlib.machinery.SourceFileLoader
)
开发者ID:GaloisInc,项目名称:echronos,代码行数:16,代码来源:test_cmd_line_script.py
示例16: setup_test_pkg
def setup_test_pkg(self, *args):
with temp_dir() as script_dir, \
test.test_support.change_cwd(script_dir):
pkg_dir = os.path.join(script_dir, 'test_pkg')
make_pkg(pkg_dir, *args)
yield pkg_dir
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:6,代码来源:test_cmd_line_script.py
注:本文中的test.script_helper.make_pkg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论