Skip to content

Commit a5d3266

Browse files
committed
Simplify tests slightly and try fresh pool
1 parent d80ebf1 commit a5d3266

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

Lib/test/test_concurrent_futures/test_process_pool.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,14 @@ def test_traceback(self):
106106
self.assertIn('raise RuntimeError(123) # some comment',
107107
f1.getvalue())
108108

109-
@staticmethod
110-
def _terminate_abruptly_with_exit_code(exit_code):
111-
os._exit(exit_code)
112-
113109
def test_traceback_when_child_process_terminates_abruptly(self):
114110
# gh-139462 enhancement - BrokenProcessPool exceptions
115111
# should describe which process terminated.
116112
exit_code = 99
117-
future = self.executor.submit(
118-
self._terminate_abruptly_with_exit_code,
119-
exit_code
120-
)
121-
with self.assertRaises(BrokenProcessPool) as bpe:
122-
future.result()
113+
with self.executor_type(max_workers=1) as executor:
114+
future = executor.submit(os._exit, exit_code)
115+
with self.assertRaises(BrokenProcessPool) as bpe:
116+
future.result()
123117

124118
cause = bpe.exception.__cause__
125119
self.assertIsInstance(cause, futures.process._RemoteTraceback)

0 commit comments

Comments
 (0)