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

Method test_issue9936

Lib/test/test_trace.py:406–425  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

404 self.assertEqual(files, ['_importlib.cover']) # Ignore __import__
405
406 def test_issue9936(self):
407 tracer = trace.Trace(trace=0, count=1)
408 modname = 'test.tracedmodules.testmod'
409 # Ensure that the module is executed in import
410 if modname in sys.modules:
411 del sys.modules[modname]
412 cmd = ("import test.tracedmodules.testmod as t;"
413 "t.func(0); t.func2();")
414 with captured_stdout() as stdout:
415 self._coverage(tracer, cmd)
416 stdout.seek(0)
417 stdout.readline()
418 coverage = {}
419 for line in stdout:
420 lines, cov, module = line.split()[:3]
421 coverage[module] = (float(lines), float(cov[:-1]))
422 # XXX This is needed to run regrtest.py as a script
423 modname = trace._fullmodname(sys.modules[modname].__file__)
424 self.assertIn(modname, coverage)
425 self.assertEqual(coverage[modname], (5, 100))
426
427 def test_coverageresults_update(self):
428 # Update empty CoverageResults with a non-empty infile.

Callers

nothing calls this directly

Calls 7

_coverageMethod · 0.95
captured_stdoutFunction · 0.90
assertInMethod · 0.80
seekMethod · 0.45
readlineMethod · 0.45
splitMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected