]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] Revert "gh-128364: Fix flaky `test_timeout` test (gh-130724)" (gh-130732)...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 1 Mar 2025 17:44:50 +0000 (18:44 +0100)
committerGitHub <noreply@github.com>
Sat, 1 Mar 2025 17:44:50 +0000 (17:44 +0000)
Revert "gh-128364: Fix flaky `test_timeout` test (gh-130724)" (gh-130732)

Change broke Android and iOS buildbots that do not have multiprocessing.

This reverts commit cfa0b1dc375e63cde28e61a47108c645b0e74834.
(cherry picked from commit 5221d9ce0e2beb0fe04bed072e1bb448fd522882)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Lib/test/test_concurrent_futures/test_wait.py
Lib/test/test_concurrent_futures/util.py

index 697285779510a94b51dc4b3895af7e0512b7742c..108cf54bf79e6f78bff0ebed851be911fd2de0c8 100644 (file)
@@ -114,8 +114,9 @@ class WaitTests:
 
     def test_timeout(self):
         short_timeout = 0.050
+        long_timeout = short_timeout * 10
 
-        future = self.executor.submit(self.event.wait)
+        future = self.executor.submit(time.sleep, long_timeout)
 
         finished, pending = futures.wait(
                 [CANCELLED_AND_NOTIFIED_FUTURE,
@@ -131,9 +132,6 @@ class WaitTests:
                          finished)
         self.assertEqual(set([future]), pending)
 
-        # Set the event to allow the future to complete
-        self.event.set()
-
 
 class ThreadPoolWaitTests(ThreadPoolMixin, WaitTests, BaseTestCase):
 
index daadb8459c31617700cb0b72d928d561e2c02cd9..3b8ec3e205d5aa77bcd6e33e9ee2f657b271f94f 100644 (file)
@@ -1,6 +1,5 @@
 import multiprocessing
 import sys
-import threading
 import time
 import unittest
 from concurrent import futures
@@ -47,14 +46,11 @@ class ExecutorMixin:
 
         self.t1 = time.monotonic()
         if hasattr(self, "ctx"):
-            self.manager = multiprocessing.Manager()
-            self.event = self.manager.Event()
             self.executor = self.executor_type(
                 max_workers=self.worker_count,
                 mp_context=self.get_context(),
                 **self.executor_kwargs)
         else:
-            self.event = threading.Event()
             self.executor = self.executor_type(
                 max_workers=self.worker_count,
                 **self.executor_kwargs)
@@ -62,9 +58,6 @@ class ExecutorMixin:
     def tearDown(self):
         self.executor.shutdown(wait=True)
         self.executor = None
-        if hasattr(self, "ctx"):
-            self.manager.shutdown()
-            self.manager = None
 
         dt = time.monotonic() - self.t1
         if support.verbose: