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

Method run_test

Lib/test/test_importlib/source/test_finder.py:50–79  ·  view source on GitHub ↗

Test the finding of 'test' with the creation of modules listed in 'create'. Any names listed in 'compile_' are byte-compiled. Modules listed in 'unlink' have their source files deleted.

(self, test, create=None, *, compile_=None, unlink=None)

Source from the content-addressed store, hash-verified

48 return self._find(finder, module, loader_only=True)
49
50 def run_test(self, test, create=None, *, compile_=None, unlink=None):
51 """Test the finding of 'test' with the creation of modules listed in
52 'create'.
53
54 Any names listed in 'compile_' are byte-compiled. Modules
55 listed in 'unlink' have their source files deleted.
56
57 """
58 if create is None:
59 create = {test}
60 if (compile_ or unlink) and sys.implementation.cache_tag is None:
61 raise unittest.SkipTest('requires sys.implementation.cache_tag')
62 with util.create_modules(*create) as mapping:
63 if compile_:
64 for name in compile_:
65 py_compile.compile(mapping[name])
66 if unlink:
67 for name in unlink:
68 os.unlink(mapping[name])
69 try:
70 make_legacy_pyc(mapping[name])
71 except OSError as error:
72 # Some tests do not set compile_=True so the source
73 # module will not get compiled and there will be no
74 # PEP 3147 pyc file to rename.
75 if error.errno != errno.ENOENT:
76 raise
77 loader = self.import_(mapping['.root'], test)
78 self.assertHasAttr(loader, 'exec_module')
79 return loader
80
81 def test_module(self):
82 # [top-level source]

Callers 3

test_moduleMethod · 0.95
test_packageMethod · 0.95

Calls 5

import_Method · 0.95
make_legacy_pycFunction · 0.90
assertHasAttrMethod · 0.80
compileMethod · 0.45
unlinkMethod · 0.45

Tested by

no test coverage detected