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

Method _do_test

Lib/test/test_modulefinder.py:326–351  ·  view source on GitHub ↗
(self, info, report=False, debug=0, replace_paths=[], modulefinder_class=modulefinder.ModuleFinder)

Source from the content-addressed store, hash-verified

324 shutil.rmtree(self.test_dir)
325
326 def _do_test(self, info, report=False, debug=0, replace_paths=[], modulefinder_class=modulefinder.ModuleFinder):
327 import_this, modules, missing, maybe_missing, source = info
328 create_package(self.test_dir, source)
329 mf = modulefinder_class(path=self.test_path, debug=debug,
330 replace_paths=replace_paths)
331 mf.import_hook(import_this)
332 if report:
333 mf.report()
334## # This wouldn't work in general when executed several times:
335## opath = sys.path[:]
336## sys.path = self.test_path
337## try:
338## __import__(import_this)
339## except:
340## import traceback; traceback.print_exc()
341## sys.path = opath
342## return
343 modules = sorted(set(modules))
344 found = sorted(mf.modules)
345 # check if we found what we expected, not more, not less
346 self.assertEqual(found, modules)
347
348 # check for missing and maybe missing modules
349 bad, maybe = mf.any_missing_maybe()
350 self.assertEqual(bad, missing)
351 self.assertEqual(maybe, maybe_missing)
352
353 def test_package(self):
354 self._do_test(package_test)

Callers 15

test_packageMethod · 0.95
test_maybeMethod · 0.95
test_maybe_newMethod · 0.95
test_absolute_importsMethod · 0.95
test_relative_importsMethod · 0.95
test_syntax_errorMethod · 0.95
test_same_name_as_badMethod · 0.95
test_bytecodeMethod · 0.95
test_replace_pathsMethod · 0.95

Calls 7

sortedFunction · 0.85
setFunction · 0.85
import_hookMethod · 0.80
any_missing_maybeMethod · 0.80
create_packageFunction · 0.70
reportMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected