Skip to content

Conversation

@AgentsLogic
Copy link

@AgentsLogic AgentsLogic commented Jan 3, 2026

Fixes #32611

Summary

This PR speeds up pytest collection by:

  1. Lazy-loading expensive imports in conftest.py - Moves OpenpilotPrefix, manager, TICI, and HARDWARE imports from module-level to inside the fixtures where they're actually used. These imports are only needed when tests run, not during collection.

  2. Replacing TICI import with file check - Instead of importing the entire openpilot.system.hardware module just to check TICI, uses a simple os.path.isfile('/TICI') check which is much faster.

  3. Using norecursedirs instead of --ignore flags - The norecursedirs option is more efficient for pytest collection as it prevents pytest from even entering those directories, rather than ignoring them after discovery.

Changes

  • conftest.py: Move imports inside fixtures, add _is_tici() helper function
  • pyproject.toml: Replace --ignore flags with norecursedirs configuration

@AgentsLogic
Copy link
Author

ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve pytest collection time to <1s

1 participant