Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "gh-128364: Fix flaky test_timeout test (gh-130724)" #130732

Merged
merged 1 commit into from
Mar 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Lib/test/test_concurrent_futures/test_wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ def test_all_completed(self):

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,
Expand All @@ -131,9 +132,6 @@ def test_timeout(self):
finished)
self.assertEqual(set([future]), pending)

# Set the event to allow the future to complete
self.event.set()


class ThreadPoolWaitTests(ThreadPoolMixin, WaitTests, BaseTestCase):

Expand Down
7 changes: 0 additions & 7 deletions Lib/test/test_concurrent_futures/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import multiprocessing
import sys
import threading
import time
import unittest
from concurrent import futures
Expand Down Expand Up @@ -47,24 +46,18 @@ def setUp(self):

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)

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:
Expand Down
Loading