]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-116682: stdout may be empty in test_cancel_futures_wait_false (#116683)
authorSam Gross <colesbury@gmail.com>
Wed, 13 Mar 2024 00:11:58 +0000 (20:11 -0400)
committerGitHub <noreply@github.com>
Wed, 13 Mar 2024 00:11:58 +0000 (20:11 -0400)
If the `shutdown()` call happens before the worker thread starts executing
the task, then nothing will be printed to stdout.

Lib/test/test_concurrent_futures/test_shutdown.py

index 45dab7a75fdd504c5d170dff61cf478a0934cb96..7a4065afd46fc840fa62d4450258e0a0c6ee05ce 100644 (file)
@@ -247,7 +247,9 @@ class ThreadPoolShutdownTest(ThreadPoolMixin, ExecutorShutdownTest, BaseTestCase
         # 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):