Skip to content

Improve pytest collection time to <1s #32611

Open
@sshane

Description

@sshane

Currently it takes ~6-7s with these plugins:

platform linux -- Python 3.11.4, pytest-8.2.1, pluggy-1.5.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=3123610973
rootdir: /home/batman/openpilot
configfile: pyproject.toml
testpaths: tools/, common/, system/, selfdrive/
plugins: anyio-4.3.0, timeout-2.3.1, xdist-3.6.1, cpp-2.5.0, cov-5.0.0, mock-3.14.0, forked-1.6.0, dash-2.11.1, benchmark-4.0.0, randomly-3.15.0, subtests-0.12.1, flaky-3.8.1, hypothesis-6.47.5, asyncio-0.23.7, nbmake-1.5.3, repeat-0.9.3
asyncio: mode=Mode.STRICT

============================================================================= 4011 tests collected in 6.46s ==============================================================================

real    0m8.935s
user    0m10.833s
sys     0m2.163s

Verification:

Run time pytest --collect-only in the root openpilot directory and post both the real time and the collection time as reported by pytest (=== 4011 tests collected in 6.61s ===). Include the times before and after your PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Open

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions