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

Method test_strip_and_prepend

Lib/test/test_compileall.py:409–428  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

407 )
408
409 def test_strip_and_prepend(self):
410 fullpath = ["test", "build", "real", "path"]
411 path = os.path.join(self.directory, *fullpath)
412 os.makedirs(path)
413 script = script_helper.make_script(path, "test", "1 / 0")
414 bc = importlib.util.cache_from_source(script)
415 stripdir = os.path.join(self.directory, *fullpath[:2])
416 prependdir = "/foo"
417 compileall.compile_dir(path, quiet=True,
418 stripdir=stripdir, prependdir=prependdir)
419 rc, out, err = script_helper.assert_python_failure(bc)
420 expected_in = os.path.join(prependdir, *fullpath[2:])
421 self.assertIn(
422 expected_in,
423 str(err, encoding=sys.getdefaultencoding())
424 )
425 self.assertNotIn(
426 stripdir,
427 str(err, encoding=sys.getdefaultencoding())
428 )
429
430 def test_strip_prepend_and_ddir(self):
431 fullpath = ["test", "build", "real", "path", "ddir"]

Callers

nothing calls this directly

Calls 7

strFunction · 0.85
compile_dirMethod · 0.80
assert_python_failureMethod · 0.80
assertInMethod · 0.80
assertNotInMethod · 0.80
joinMethod · 0.45
make_scriptMethod · 0.45

Tested by

no test coverage detected