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

Method test_issue9936

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

Source from the content-addressed store, hash-verified

410
411 @unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 'test.tracedmodules.testmod' not found in {}
412 def test_issue9936(self):
413 tracer = trace.Trace(trace=0, count=1)
414 modname = 'test.tracedmodules.testmod'
415 # Ensure that the module is executed in import
416 if modname in sys.modules:
417 del sys.modules[modname]
418 cmd = ("import test.tracedmodules.testmod as t;"
419 "t.func(0); t.func2();")
420 with captured_stdout() as stdout:
421 self._coverage(tracer, cmd)
422 stdout.seek(0)
423 stdout.readline()
424 coverage = {}
425 for line in stdout:
426 lines, cov, module = line.split()[:3]
427 coverage[module] = (float(lines), float(cov[:-1]))
428 # XXX This is needed to run regrtest.py as a script
429 modname = trace._fullmodname(sys.modules[modname].__file__)
430 self.assertIn(modname, coverage)
431 self.assertEqual(coverage[modname], (5, 100))
432
433 def test_coverageresults_update(self):
434 # 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