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

Method _do_test

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

Source from the content-addressed store, hash-verified

336 shutil.rmtree(self.test_dir)
337
338 def _do_test(self, info, report=False, debug=0, replace_paths=[], modulefinder_class=modulefinder.ModuleFinder):
339 import_this, modules, missing, maybe_missing, source = info
340 create_package(self.test_dir, source)
341 mf = modulefinder_class(path=self.test_path, debug=debug,
342 replace_paths=replace_paths)
343 mf.import_hook(import_this)
344 if report:
345 mf.report()
346## # This wouldn't work in general when executed several times:
347## opath = sys.path[:]
348## sys.path = self.test_path
349## try:
350## __import__(import_this)
351## except:
352## import traceback; traceback.print_exc()
353## sys.path = opath
354## return
355 modules = sorted(set(modules))
356 found = sorted(mf.modules)
357 # check if we found what we expected, not more, not less
358 self.assertEqual(found, modules)
359
360 # check for missing and maybe missing modules
361 bad, maybe = mf.any_missing_maybe()
362 self.assertEqual(bad, missing)
363 self.assertEqual(maybe, maybe_missing)
364
365 def test_package(self):
366 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

Calls 6

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