Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tests call sleeping_retry() with SHORT_TIMEOUT#93870

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 1 commit intopython:mainfromvstinner:sleeping_retry_const
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes fromall 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
Tests call sleeping_retry() with SHORT_TIMEOUT
Tests now call busy_retry() and sleeping_retry() with SHORT_TIMEOUTor LONG_TIMEOUT (of test.support), rather than hardcoded constants.Add also WAIT_ACTIVE_CHILDREN_TIMEOUT constant to_test_multiprocessing.
  • Loading branch information
@vstinner
vstinner committedJun 15, 2022
commit9e6f6d38660ab5774fff168a05d00496c7a9d43f
2 changes: 1 addition & 1 deletionLib/test/_test_eintr.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -497,7 +497,7 @@ def _lock(self, lock_func, lock_name):
with open(os_helper.TESTFN, 'wb') as f:
# synchronize the subprocess
start_time = time.monotonic()
for _ in support.sleeping_retry(60.0, error=False):
for _ in support.sleeping_retry(support.LONG_TIMEOUT, error=False):
try:
lock_func(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
lock_func(f, fcntl.LOCK_UN)
Expand Down
8 changes: 6 additions & 2 deletionsLib/test/_test_multiprocessing.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -124,6 +124,8 @@ def _resource_unlink(name, rtype):
# BaseManager.shutdown_timeout
SHUTDOWN_TIMEOUT = support.SHORT_TIMEOUT

WAIT_ACTIVE_CHILDREN_TIMEOUT = 5.0

HAVE_GETVALUE = not getattr(_multiprocessing,
'HAVE_BROKEN_SEM_GETVALUE', False)

Expand DownExpand Up@@ -5569,8 +5571,9 @@ def wait_proc_exit(self):
# if there are other children too (see #17395).
join_process(self.proc)

timeout = WAIT_ACTIVE_CHILDREN_TIMEOUT
start_time = time.monotonic()
for _ in support.sleeping_retry(5.0, error=False):
for _ in support.sleeping_retry(timeout, error=False):
if len(multiprocessing.active_children()) <= 1:
break
else:
Expand DownExpand Up@@ -5875,8 +5878,9 @@ def tearDownClass(cls):
# only the manager process should be returned by active_children()
# but this can take a bit on slow machines, so wait a few seconds
# if there are other children too (see #17395)
timeout = WAIT_ACTIVE_CHILDREN_TIMEOUT
start_time = time.monotonic()
for _ in support.sleeping_retry(5.0, error=False):
for _ in support.sleeping_retry(timeout, error=False):
if len(multiprocessing.active_children()) <= 1:
break
else:
Expand Down
2 changes: 1 addition & 1 deletionLib/test/test_asyncore.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,7 +76,7 @@ def capture_server(evt, buf, serv):
pass
else:
n = 200
for _ in support.busy_retry(3.0, error=False):
for _ in support.busy_retry(support.SHORT_TIMEOUT, error=False):
r, w, e = select.select([conn], [], [], 0.1)
if r:
n -= 1
Expand Down
3 changes: 2 additions & 1 deletionLib/test/test_concurrent_futures.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -258,7 +258,8 @@ def test_initializer(self):
future.result()

# At some point, the executor should break
for _ in support.sleeping_retry(5, "executor not broken"):
for _ in support.sleeping_retry(support.SHORT_TIMEOUT,
"executor not broken"):
if self.executor._broken:
break

Expand Down
6 changes: 4 additions & 2 deletionsLib/test/test_multiprocessing_main_handling.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,7 +62,8 @@ def f(x):
pool.map_async(f, [1, 2, 3], callback=results.extend)

# up to 1 min to report the results
for _ in support.sleeping_retry(60, "Timed out waiting for results"):
for _ in support.sleeping_retry(support.LONG_TIMEOUT,
"Timed out waiting for results"):
if results:
break

Expand DownExpand Up@@ -93,7 +94,8 @@ def f(x):
with Pool(5) as pool:
pool.map_async(int, [1, 4, 9], callback=results.extend)
# up to 1 min to report the results
for _ in support.sleeping_retry(60, "Timed out waiting for results"):
for _ in support.sleeping_retry(support.LONG_TIMEOUT,
"Timed out waiting for results"):
if results:
break

Expand Down
4 changes: 2 additions & 2 deletionsLib/test/test_signal.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -812,7 +812,7 @@ def test_itimer_virtual(self):
signal.signal(signal.SIGVTALRM, self.sig_vtalrm)
signal.setitimer(self.itimer, 0.3, 0.2)

for _ in support.busy_retry(60.0, error=False):
for _ in support.busy_retry(support.LONG_TIMEOUT, error=False):
# use up some virtual time by doing real work
_ = pow(12345, 67890, 10000019)
if signal.getitimer(self.itimer) == (0.0, 0.0):
Expand All@@ -833,7 +833,7 @@ def test_itimer_prof(self):
signal.signal(signal.SIGPROF, self.sig_prof)
signal.setitimer(self.itimer, 0.2, 0.2)

for _ in support.busy_retry(60.0, error=False):
for _ in support.busy_retry(support.LONG_TIMEOUT, error=False):
# do some work
_ = pow(12345, 67890, 10000019)
if signal.getitimer(self.itimer) == (0.0, 0.0):
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp