(self, test_function, repeats=None)
| 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) |
no test coverage detected