MCPcopy Index your code
hub / github.com/RustPython/RustPython / run_test

Method run_test

Lib/test/test_importlib/source/test_finder.py:50–77  ·  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 with util.create_modules(*create) as mapping:
61 if compile_:
62 for name in compile_:
63 py_compile.compile(mapping[name])
64 if unlink:
65 for name in unlink:
66 os.unlink(mapping[name])
67 try:
68 make_legacy_pyc(mapping[name])
69 except OSError as error:
70 # Some tests do not set compile_=True so the source
71 # module will not get compiled and there will be no
72 # PEP 3147 pyc file to rename.
73 if error.errno != errno.ENOENT:
74 raise
75 loader = self.import_(mapping['.root'], test)
76 self.assertHasAttr(loader, 'load_module')
77 return loader
78
79 def test_module(self):
80 # [top-level source]

Callers 3

test_moduleMethod · 0.95
test_packageMethod · 0.95

Calls 5

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

Tested by

no test coverage detected