From 92975bcd5f6281d6124f30cd4a71e0adedd78781 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 16 Mar 2021 12:41:00 +0000 Subject: [PATCH] Refs #31370 -- Added test for pickling RemoteTestResult. --- tests/test_runner/test_parallel.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_runner/test_parallel.py b/tests/test_runner/test_parallel.py index 70959012b58..365c248a43f 100644 --- a/tests/test_runner/test_parallel.py +++ b/tests/test_runner/test_parallel.py @@ -1,3 +1,4 @@ +import pickle import unittest from django.test import SimpleTestCase @@ -51,6 +52,11 @@ class SampleFailingSubtest(SimpleTestCase): class RemoteTestResultTest(SimpleTestCase): + def test_picklable(self): + result = RemoteTestResult() + loaded_result = pickle.loads(pickle.dumps(result)) + self.assertEqual(result.events, loaded_result.events) + def test_pickle_errors_detection(self): picklable_error = RuntimeError('This is fine') not_unpicklable_error = ExceptionThatFailsUnpickling('arg')