[3.11] gh-116682: stdout may be empty in test_cancel_futures_wait_false (GH-116683) (#116693)

If the `shutdown()` call happens before the worker thread starts executing
the task, then nothing will be printed to stdout.
(cherry picked from commit 7d1abe9502)

Co-authored-by: Sam Gross <colesbury@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-03-13 01:29:03 +01:00 committed by GitHub
parent 0917338c78
commit a01621aeb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -247,7 +247,9 @@ def test_cancel_futures_wait_false(self):
# Errors in atexit hooks don't change the process exit code, check
# stderr manually.
self.assertFalse(err)
self.assertEqual(out.strip(), b"apple")
# gh-116682: stdout may be empty if shutdown happens before task
# starts executing.
self.assertIn(out.strip(), [b"apple", b""])
class ProcessPoolShutdownTest(ExecutorShutdownTest):