mirror of
https://github.com/django/django.git
synced 2025-10-25 06:36:07 +00:00
[6.0.x] Fixed #36491 -- Fixed crash in ParallelTestRunner with --buffer.
Thanks Javier Buzzi and Adam Johnson for reviews.
Co-authored-by: Simon Charette <charette.s@gmail.com>
Backport of be581ff473 from main.
This commit is contained in:
committed by
Jacob Walls
parent
db2f206ee1
commit
f8e91d0104
@@ -282,3 +282,27 @@ class ParallelTestSuiteTest(SimpleTestCase):
|
||||
|
||||
self.assertEqual(len(result.errors), 0)
|
||||
self.assertEqual(len(result.failures), 0)
|
||||
|
||||
def test_buffer_mode_reports_setupclass_failure(self):
|
||||
test = SampleErrorTest("dummy_test")
|
||||
remote_result = RemoteTestResult()
|
||||
suite = TestSuite([test])
|
||||
suite.run(remote_result)
|
||||
|
||||
pts = ParallelTestSuite([suite], processes=2, buffer=True)
|
||||
pts.serialized_aliases = set()
|
||||
test_result = TestResult()
|
||||
test_result.buffer = True
|
||||
|
||||
with unittest.mock.patch("multiprocessing.Pool") as mock_pool:
|
||||
|
||||
def fake_next(*args, **kwargs):
|
||||
test_result.shouldStop = True
|
||||
return (0, remote_result.events)
|
||||
|
||||
mock_pool.return_value.imap_unordered.return_value = unittest.mock.Mock(
|
||||
next=fake_next
|
||||
)
|
||||
pts.run(test_result)
|
||||
|
||||
self.assertIn("ValueError: woops", test_result.errors[0][1])
|
||||
|
||||
Reference in New Issue
Block a user