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

Method test_strip_only

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

Source from the content-addressed store, hash-verified

348 return self._test_ddir_only(ddir="", parallel=True)
349
350 def test_strip_only(self):
351 fullpath = ["test", "build", "real", "path"]
352 path = os.path.join(self.directory, *fullpath)
353 os.makedirs(path)
354 script = script_helper.make_script(path, "test", "1 / 0")
355 bc = importlib.util.cache_from_source(script)
356 stripdir = os.path.join(self.directory, *fullpath[:2])
357 compileall.compile_dir(path, quiet=True, stripdir=stripdir)
358 rc, out, err = script_helper.assert_python_failure(bc)
359 expected_in = os.path.join(*fullpath[2:])
360 self.assertIn(
361 expected_in,
362 str(err, encoding=sys.getdefaultencoding())
363 )
364 self.assertNotIn(
365 stripdir,
366 str(err, encoding=sys.getdefaultencoding())
367 )
368
369 def test_strip_only_invalid(self):
370 fullpath = ["test", "build", "real", "path"]

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