(self)
| 3168 | |
| 3169 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 3170 | def test_traceback(self): |
| 3171 | # We want ensure that the traceback from the child process is |
| 3172 | # contained in the traceback raised in the main process. |
| 3173 | if self.TYPE == 'processes': |
| 3174 | with self.Pool(1) as p: |
| 3175 | try: |
| 3176 | p.apply(self._test_traceback) |
| 3177 | except Exception as e: |
| 3178 | exc = e |
| 3179 | else: |
| 3180 | self.fail('expected RuntimeError') |
| 3181 | p.join() |
| 3182 | self.assertIs(type(exc), RuntimeError) |
| 3183 | self.assertEqual(exc.args, (123,)) |
| 3184 | cause = exc.__cause__ |
| 3185 | self.assertIs(type(cause), multiprocessing.pool.RemoteTraceback) |
| 3186 | self.assertIn('raise RuntimeError(123) # some comment', cause.tb) |
| 3187 | |
| 3188 | with test.support.captured_stderr() as f1: |
| 3189 | try: |
| 3190 | raise exc |
| 3191 | except RuntimeError: |
| 3192 | sys.excepthook(*sys.exc_info()) |
| 3193 | self.assertIn('raise RuntimeError(123) # some comment', |
| 3194 | f1.getvalue()) |
| 3195 | # _helper_reraises_exception should not make the error |
| 3196 | # a remote exception |
| 3197 | with self.Pool(1) as p: |
| 3198 | try: |
| 3199 | p.map(sqr, exception_throwing_generator(1, -1), 1) |
| 3200 | except Exception as e: |
| 3201 | exc = e |
| 3202 | else: |
| 3203 | self.fail('expected SayWhenError') |
| 3204 | self.assertIs(type(exc), SayWhenError) |
| 3205 | self.assertIs(exc.__cause__, None) |
| 3206 | p.join() |
| 3207 | |
| 3208 | @classmethod |
| 3209 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
nothing calls this directly
no test coverage detected