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

Method run

Lib/test/test_unittest/test_runner.py:1396–1411  ·  view source on GitHub ↗
(test, *, expect_durations=True)

Source from the content-addressed store, hash-verified

1394
1395 def test_durations(self):
1396 def run(test, *, expect_durations=True):
1397 stream = BufferedWriter()
1398 runner = unittest.TextTestRunner(stream=stream, durations=5, verbosity=2)
1399 result = runner.run(test)
1400 self.assertEqual(result.durations, 5)
1401 stream.flush()
1402 text = stream.getvalue()
1403 regex = r"\n\d+.\d\d\ds"
1404 if expect_durations:
1405 self.assertEqual(len(result.collectedDurations), 1)
1406 self.assertIn('Slowest test durations', text)
1407 self.assertRegex(text, regex)
1408 else:
1409 self.assertEqual(len(result.collectedDurations), 0)
1410 self.assertNotIn('Slowest test durations', text)
1411 self.assertNotRegex(text, regex)
1412
1413 # success
1414 class Foo(unittest.TestCase):

Callers 4

runTestsFunction · 0.45
testCleanupInRunMethod · 0.45

Calls 10

runMethod · 0.95
flushMethod · 0.95
getvalueMethod · 0.95
BufferedWriterClass · 0.90
lenFunction · 0.85
assertInMethod · 0.80
assertRegexMethod · 0.80
assertNotInMethod · 0.80
assertNotRegexMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected