Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

quality.testing

Avoid time.sleep in Python unit tests

Sleeping in tests slows suites and hides synchronization bugs.

#Metadata

Rule ID
py.testing.time-sleep-in-unit-test
Severity
low
Confidence
0.6
Languages
python
Presets
recommended, strict
Stability
experimental
Applies to
block
Tags
python, rules-catalog, testing

#Why it matters

Prefer deterministic waits, polling helpers, or clock fakes.

#Remediation

Inject a clock, shorten waits, or move timing-sensitive coverage to integration tests.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/python/py.testing.time-sleep-in-unit-test.rule.yaml.