MCPcopy Index your code
hub / github.com/python/cpython / test_issue8202

Method test_issue8202

Lib/test/test_cmd_line_script.py:380–395  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

378 self._check_import_error(["-m", "test_pkg"], msg, cwd=script_dir)
379
380 def test_issue8202(self):
381 # Make sure package __init__ modules see "-m" in sys.argv0 while
382 # searching for the module to execute
383 with os_helper.temp_dir() as script_dir:
384 with os_helper.change_cwd(path=script_dir):
385 pkg_dir = os.path.join(script_dir, 'test_pkg')
386 make_pkg(pkg_dir, "import sys; print('init_argv0==%r' % sys.argv[0])")
387 script_name = _make_test_script(pkg_dir, 'script')
388 rc, out, err = assert_python_ok('-m', 'test_pkg.script', *example_args, __isolated=False)
389 if verbose > 1:
390 print(repr(out))
391 expected = "init_argv0==%r" % '-m'
392 self.assertIn(expected.encode('utf-8'), out)
393 self._check_output(script_name, rc, out,
394 script_name, script_name, script_dir, 'test_pkg',
395 importlib.machinery.SourceFileLoader)
396
397 def test_issue8202_dash_c_file_ignored(self):
398 # Make sure a "-c" file in the current directory

Callers

nothing calls this directly

Calls 8

_check_outputMethod · 0.95
make_pkgFunction · 0.90
assert_python_okFunction · 0.90
temp_dirMethod · 0.80
assertInMethod · 0.80
_make_test_scriptFunction · 0.70
joinMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected