diff options
Diffstat (limited to 'tests/test_runner')
| -rw-r--r-- | tests/test_runner/test_parallel.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_runner/test_parallel.py b/tests/test_runner/test_parallel.py index eea9e4de74..5fbd0658b5 100644 --- a/tests/test_runner/test_parallel.py +++ b/tests/test_runner/test_parallel.py @@ -21,6 +21,12 @@ class ExceptionThatFailsUnpickling(Exception): def __init__(self, arg): super().__init__() + def __reduce__(self): + # tblib 3.2+ makes exception subclasses picklable by default. + # Return (cls, ()) so the constructor fails on unpickle, preserving + # the needed behavior for test_pickle_errors_detection. + return (self.__class__, ()) + class ParallelTestRunnerTest(SimpleTestCase): """ @@ -102,6 +108,8 @@ class RemoteTestResultTest(SimpleTestCase): result = RemoteTestResult() result._confirm_picklable(picklable_error) + # The exception can be pickled but not unpickled. + pickle.dumps(not_unpicklable_error) msg = "__init__() missing 1 required positional argument" with self.assertRaisesMessage(TypeError, msg): result._confirm_picklable(not_unpicklable_error) |
