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

Method withRepeats

Lib/test/test_unittest/test_break.py:31–50  ·  view source on GitHub ↗
(self, test_function, repeats=None)

Source from the content-addressed store, hash-verified

29
30
31 def withRepeats(self, test_function, repeats=None):
32 if not support.check_impl_detail(cpython=True):
33 # Override repeats count on non-cpython to execute only once.
34 # Because this test only makes sense to be repeated on CPython.
35 repeats = 1
36 elif repeats is None:
37 repeats = self.default_repeats
38
39 for repeat in range(repeats):
40 with self.subTest(repeat=repeat):
41 # We don't run `setUp` for the very first repeat
42 # and we don't run `tearDown` for the very last one,
43 # because they are handled by the test class itself.
44 if repeat != 0:
45 self.setUp()
46 try:
47 test_function()
48 finally:
49 if repeat != repeats - 1:
50 self.tearDown()
51
52 def testInstallHandler(self):
53 default_handler = signal.getsignal(signal.SIGINT)

Callers 4

testInterruptCaughtMethod · 0.95
testSecondInterruptMethod · 0.95
testTwoResultsMethod · 0.95

Calls 4

setUpMethod · 0.95
tearDownMethod · 0.95
test_functionFunction · 0.85
subTestMethod · 0.45

Tested by

no test coverage detected