Registry / testing / wait-for

wait-for

JSON →
library1.2.0pypypi✓ verified 85d ago

A waiting utility with decorator and logger support, providing configurable retries, timeouts, and custom conditions. Current version 1.2.0. Release cadence: irregular (last release Oct 2020). Supports Python >=3.6.

pip install wait-for
INSTALL
IMPORT
SIG · WAIT-FOR
W
wait-for
testingpythonv1.2.0
Install
1.6s avg
Import
89ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.094s · 18.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.084s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

wait_for
from wait_for import wait_for
Common mistake is to import 'wait' or 'wait_for' from other libraries like 'tenacity'.
TimedOutError
from wait_for import TimedOutError
Import TimedOutError for timeouts.

Waits for a condition to be true, retrying every `delay` seconds until `timeout`. Returns (result, elapsed_time) on success, raises TimedOutError on timeout.

from wait_for import wait_for import time def check_condition(): # Replace with actual condition logic return False try: result, elapsed = wait_for(check_condition, timeout=10, delay=1) print('Success', result, elapsed) except Exception as e: print('Failed:', e)
Debug
Known issues
gotchaIf `check_condition` raises an exception, `wait_for` retries by default (silent_failure=False). To avoid infinite retries on errors, set `silent_failure=True` or catch exceptions inside the condition.
fix
Set `silent_failure=True` in the call to ignore exceptions and treat them as failures.
affects: all
gotchaThe `num_sec` argument for `delay` is explicitly converted to `float`. Passing a string or non-numeric type will raise a `TypeError`.
fix
Always pass a number (int/float) for `delay` and `timeout`.
affects: >=1.1.0
deprecatedPython 2.7, 3.3, and 3.4 support was dropped in version 1.1.0. Using with these versions will fail.
fix
Upgrade to Python 3.6+.
affects: >=1.1.0
Errors
Common errors & fixes
TypeError: 'float' object cannot be interpreted as an integer
Passing a float timeout value before version 1.1.0; older versions expected integer.
fix
Update to wait-for 1.1.0+ (explicit float conversion) or ensure timeout is an integer.
ImportError: cannot import name 'wait_for' from 'wait_for'
Incorrect installation or missing package (typo in package name: wait-for vs wait_for).
fix
Install the correct package: `pip install wait-for` (note the hyphen).
wait_for() missing 1 required positional argument: 'func'
Calling `wait_for()` without a callable (the function to wait for).
fix
Pass a callable as the first argument: `wait_for(my_func, timeout=10)`.
Upgrade
Version history
1.2.0latest on PyPI · released Sep 29, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
31 hits · last 30 days
node
28
Resources
wait-for — pip install wait-for · libregistry