Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
111 changes: 107 additions & 4 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,109 @@
import contextlib
import gc
import os

# Pre-warm heavy imports before pytest collection
try:
import numpy # noqa: F401
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'numpy' is not used.

Suggested change
import numpy # noqa: F401
import numpy # noqa: F401
_ = getattr(numpy, "__version__", None)

Copilot uses AI. Check for mistakes.
except ImportError:
pass

try:
import hypothesis # noqa: F401
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'hypothesis' is not used.

Copilot uses AI. Check for mistakes.
except ImportError:
pass

try:
import cereal
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing noqa comment for unused import. The cereal import at line 17 is imported for pre-warming but not used, similar to the other pre-warming imports. It should have a # noqa: F401 comment to suppress the unused import warning, consistent with the other pre-warming imports in this section.

Suggested change
import cereal
import cereal # noqa: F401

Copilot uses AI. Check for mistakes.
except ImportError:
pass

try:
Comment on lines +17 to +21
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module 'cereal' is imported with both 'import' and 'import from'.

Suggested change
import cereal
except ImportError:
pass
try:

Copilot uses AI. Check for mistakes.
from opendbc import car # noqa: F401
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'car' is not used.

Suggested change
from opendbc import car # noqa: F401
from opendbc import car # noqa: F401
_ = car

Copilot uses AI. Check for mistakes.
except ImportError:
pass

try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'LogReader' is not used.

Copilot uses AI. Check for mistakes.
except ImportError:
pass

try:
import casadi # noqa: F401
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'casadi' is not used.

Copilot uses AI. Check for mistakes.
except ImportError:
pass

try:
from openpilot.common.params import Params # noqa: F401
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'Params' is not used.

Copilot uses AI. Check for mistakes.
except ImportError:
pass

try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass

try:
Comment on lines +42 to +46
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'helpers' is not used.

Suggested change
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:

Copilot uses AI. Check for mistakes.
import parameterized # noqa: F401
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'parameterized' is not used.

Suggested change
import parameterized # noqa: F401
import parameterized # noqa: F401
_ = parameterized

Copilot uses AI. Check for mistakes.
except ImportError:
Comment on lines +8 to +48
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
except ImportError:
# Optional dependency; ignore if not installed and let tests handle absence.
pass
try:
import hypothesis # noqa: F401
except ImportError:
# Optional dependency; ignore if not installed and let tests handle absence.
pass
try:
import cereal
except ImportError:
# Optional dependency; ignore if not installed and let tests handle absence.
pass
try:
from opendbc import car # noqa: F401
except ImportError:
# Optional dependency; ignore if not installed and let tests handle absence.
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
# Optional dependency; ignore if not installed and let tests handle absence.
pass
try:
import casadi # noqa: F401
except ImportError:
# Optional dependency; ignore if not installed and let tests handle absence.
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
# Optional dependency; ignore if not installed and let tests handle absence.
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
# Optional dependency; ignore if not installed and let tests handle absence.
pass
try:
import parameterized # noqa: F401
except ImportError:
# Optional dependency; ignore if not installed and let tests handle absence.

Copilot uses AI. Check for mistakes.
pass

try:
import cereal.messaging # noqa: F401
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'cereal' is not used.

Copilot uses AI. Check for mistakes.
except ImportError:
Comment on lines +8 to +53
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
except ImportError:
# Optional dependency for test pre-warming; safe to ignore if not installed.
pass
try:
import hypothesis # noqa: F401
except ImportError:
# Optional dependency for test pre-warming; safe to ignore if not installed.
pass
try:
import cereal
except ImportError:
# Optional dependency for test pre-warming; safe to ignore if not installed.
pass
try:
from opendbc import car # noqa: F401
except ImportError:
# Optional dependency for test pre-warming; safe to ignore if not installed.
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
# Optional dependency for test pre-warming; safe to ignore if not installed.
pass
try:
import casadi # noqa: F401
except ImportError:
# Optional dependency for test pre-warming; safe to ignore if not installed.
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
# Optional dependency for test pre-warming; safe to ignore if not installed.
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
# Optional dependency for test pre-warming; safe to ignore if not installed.
pass
try:
import parameterized # noqa: F401
except ImportError:
# Optional dependency for test pre-warming; safe to ignore if not installed.
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
# Optional dependency for test pre-warming; safe to ignore if not installed.

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +53
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
except ImportError:
# Optional dependency: tests can run without pre-warming this import.
pass
try:
import hypothesis # noqa: F401
except ImportError:
# Optional dependency: tests can run without pre-warming this import.
pass
try:
import cereal
except ImportError:
# Optional dependency: tests can run without pre-warming this import.
pass
try:
from opendbc import car # noqa: F401
except ImportError:
# Optional dependency: tests can run without pre-warming this import.
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
# Optional dependency: tests can run without pre-warming this import.
pass
try:
import casadi # noqa: F401
except ImportError:
# Optional dependency: tests can run without pre-warming this import.
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
# Optional dependency: tests can run without pre-warming this import.
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
# Optional dependency: tests can run without pre-warming this import.
pass
try:
import parameterized # noqa: F401
except ImportError:
# Optional dependency: tests can run without pre-warming this import.
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
# Optional dependency: tests can run without pre-warming this import.

Copilot uses AI. Check for mistakes.
pass
Comment on lines +6 to +54
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
try:
import numpy # noqa: F401
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
pass
with contextlib.suppress(ImportError):
import numpy # noqa: F401
with contextlib.suppress(ImportError):
import hypothesis # noqa: F401
with contextlib.suppress(ImportError):
import cereal
with contextlib.suppress(ImportError):
from opendbc import car # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.tools.lib.logreader import LogReader # noqa: F401
with contextlib.suppress(ImportError):
import casadi # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.common.params import Params # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.selfdrive.test import helpers # noqa: F401
with contextlib.suppress(ImportError):
import parameterized # noqa: F401
with contextlib.suppress(ImportError):
import cereal.messaging # noqa: F401

Copilot uses AI. Check for mistakes.

try:
from cereal import log # noqa: F401
except ImportError:
Comment on lines +8 to +58
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
pass
try:
from cereal import log # noqa: F401
except ImportError:
except ImportError: # Optional dependency for tests; ignore if not installed
pass
try:
import hypothesis # noqa: F401
except ImportError: # Optional dependency for tests; ignore if not installed
pass
try:
import cereal
except ImportError: # Optional dependency for tests; ignore if not installed
pass
try:
from opendbc import car # noqa: F401
except ImportError: # Optional dependency for tests; ignore if not installed
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError: # Optional dependency for tests; ignore if not installed
pass
try:
import casadi # noqa: F401
except ImportError: # Optional dependency for tests; ignore if not installed
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError: # Optional dependency for tests; ignore if not installed
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError: # Optional dependency for tests; ignore if not installed
pass
try:
import parameterized # noqa: F401
except ImportError: # Optional dependency for tests; ignore if not installed
pass
try:
import cereal.messaging # noqa: F401
except ImportError: # Optional dependency for tests; ignore if not installed
pass
try:
from cereal import log # noqa: F401
except ImportError: # Optional dependency for tests; ignore if not installed

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +58
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
pass
try:
from cereal import log # noqa: F401
except ImportError:
except ImportError:
# Optional dependency: tests requiring this will be skipped if the import is unavailable.
pass
try:
import hypothesis # noqa: F401
except ImportError:
# Optional dependency: tests requiring this will be skipped if the import is unavailable.
pass
try:
import cereal
except ImportError:
# Optional dependency: tests requiring this will be skipped if the import is unavailable.
pass
try:
from opendbc import car # noqa: F401
except ImportError:
# Optional dependency: tests requiring this will be skipped if the import is unavailable.
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
# Optional dependency: tests requiring this will be skipped if the import is unavailable.
pass
try:
import casadi # noqa: F401
except ImportError:
# Optional dependency: tests requiring this will be skipped if the import is unavailable.
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
# Optional dependency: tests requiring this will be skipped if the import is unavailable.
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
# Optional dependency: tests requiring this will be skipped if the import is unavailable.
pass
try:
import parameterized # noqa: F401
except ImportError:
# Optional dependency: tests requiring this will be skipped if the import is unavailable.
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
# Optional dependency: tests requiring this will be skipped if the import is unavailable.
pass
try:
from cereal import log # noqa: F401
except ImportError:
# Optional dependency: tests requiring this will be skipped if the import is unavailable.

Copilot uses AI. Check for mistakes.
pass
Comment on lines +6 to +59
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
try:
import numpy # noqa: F401
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
pass
try:
from cereal import log # noqa: F401
except ImportError:
pass
with contextlib.suppress(ImportError):
import numpy # noqa: F401
with contextlib.suppress(ImportError):
import hypothesis # noqa: F401
with contextlib.suppress(ImportError):
import cereal
with contextlib.suppress(ImportError):
from opendbc import car # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.tools.lib.logreader import LogReader # noqa: F401
with contextlib.suppress(ImportError):
import casadi # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.common.params import Params # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.selfdrive.test import helpers # noqa: F401
with contextlib.suppress(ImportError):
import parameterized # noqa: F401
with contextlib.suppress(ImportError):
import cereal.messaging # noqa: F401
with contextlib.suppress(ImportError):
from cereal import log # noqa: F401

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +59
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
pass
try:
from cereal import log # noqa: F401
except ImportError:
pass
except ImportError:
# Optional dependency; safe to skip if not installed during test collection.
pass
try:
import hypothesis # noqa: F401
except ImportError:
# Optional dependency; safe to skip if not installed during test collection.
pass
try:
import cereal
except ImportError:
# Optional dependency; safe to skip if not installed during test collection.
pass
try:
from opendbc import car # noqa: F401
except ImportError:
# Optional dependency; safe to skip if not installed during test collection.
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
# Optional dependency; safe to skip if not installed during test collection.
pass
try:
import casadi # noqa: F401
except ImportError:
# Optional dependency; safe to skip if not installed during test collection.
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
# Optional dependency; safe to skip if not installed during test collection.
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
# Optional dependency; safe to skip if not installed during test collection.
pass
try:
import parameterized # noqa: F401
except ImportError:
# Optional dependency; safe to skip if not installed during test collection.
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
# Optional dependency; safe to skip if not installed during test collection.
pass
try:
from cereal import log # noqa: F401
except ImportError:
# Optional dependency; safe to skip if not installed during test collection.
pass
pass

Copilot uses AI. Check for mistakes.

try:
from panda import Panda # noqa: F401
except ImportError:
Comment on lines +8 to +63
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
pass
try:
from cereal import log # noqa: F401
except ImportError:
pass
try:
from panda import Panda # noqa: F401
except ImportError:
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.
pass
try:
import hypothesis # noqa: F401
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.
pass
try:
import cereal
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.
pass
try:
from opendbc import car # noqa: F401
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.
pass
try:
import casadi # noqa: F401
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.
pass
try:
import parameterized # noqa: F401
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.
pass
try:
from cereal import log # noqa: F401
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.
pass
try:
from panda import Panda # noqa: F401
except ImportError:
# Optional dependency for tests; safe to ignore if not installed.

Copilot uses AI. Check for mistakes.
pass

try:
Comment on lines +62 to +66
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'Panda' is not used.

Suggested change
from panda import Panda # noqa: F401
except ImportError:
pass
try:

Copilot uses AI. Check for mistakes.
from openpilot.system.manager.process_config import managed_processes # noqa: F401
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'managed_processes' is not used.

Copilot uses AI. Check for mistakes.
except ImportError:
Comment on lines +8 to +68
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
pass
try:
from cereal import log # noqa: F401
except ImportError:
pass
try:
from panda import Panda # noqa: F401
except ImportError:
pass
try:
from openpilot.system.manager.process_config import managed_processes # noqa: F401
except ImportError:
except ImportError:
# Optional dependency; safe to skip pre-warming if numpy is not installed.
pass
try:
import hypothesis # noqa: F401
except ImportError:
# Optional dependency; safe to skip pre-warming if hypothesis is not installed.
pass
try:
import cereal
except ImportError:
# Optional dependency; safe to skip pre-warming if cereal is not installed.
pass
try:
from opendbc import car # noqa: F401
except ImportError:
# Optional dependency; safe to skip pre-warming if opendbc is not installed.
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
# Optional dependency; safe to skip pre-warming if openpilot tools are not installed.
pass
try:
import casadi # noqa: F401
except ImportError:
# Optional dependency; safe to skip pre-warming if casadi is not installed.
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
# Optional dependency; safe to skip pre-warming if openpilot common is not installed.
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
# Optional dependency; safe to skip pre-warming if openpilot selfdrive tests are not installed.
pass
try:
import parameterized # noqa: F401
except ImportError:
# Optional dependency; safe to skip pre-warming if parameterized is not installed.
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
# Optional dependency; safe to skip pre-warming if cereal.messaging is not installed.
pass
try:
from cereal import log # noqa: F401
except ImportError:
# Optional dependency; safe to skip pre-warming if cereal.log is not installed.
pass
try:
from panda import Panda # noqa: F401
except ImportError:
# Optional dependency; safe to skip pre-warming if panda is not installed.
pass
try:
from openpilot.system.manager.process_config import managed_processes # noqa: F401
except ImportError:
# Optional dependency; safe to skip pre-warming if openpilot system manager is not installed.

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +68
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
pass
try:
from cereal import log # noqa: F401
except ImportError:
pass
try:
from panda import Panda # noqa: F401
except ImportError:
pass
try:
from openpilot.system.manager.process_config import managed_processes # noqa: F401
except ImportError:
except ImportError:
# Optional dependency for speeding up tests; ignore if not installed.
pass
try:
import hypothesis # noqa: F401
except ImportError:
# Optional dependency for property-based tests; tests will be skipped or reduced if absent.
pass
try:
import cereal
except ImportError:
# Optional dependency; some tests may be skipped or have reduced functionality if absent.
pass
try:
from opendbc import car # noqa: F401
except ImportError:
# Optional dependency; ignore if not installed in this environment.
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
# Optional dependency used by certain tests; ignore if unavailable.
pass
try:
import casadi # noqa: F401
except ImportError:
# Optional optimization/solver dependency; tests handle its absence.
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
# Optional openpilot dependency; ignore if project components are not installed.
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
# Optional openpilot test helpers; tests may be limited without this module.
pass
try:
import parameterized # noqa: F401
except ImportError:
# Optional test utility; parameterized tests may not run if missing.
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
# Optional messaging dependency; ignore if not installed.
pass
try:
from cereal import log # noqa: F401
except ImportError:
# Optional logging schema dependency; tests adapt if unavailable.
pass
try:
from panda import Panda # noqa: F401
except ImportError:
# Optional hardware interface dependency; tests that need Panda will handle its absence.
pass
try:
from openpilot.system.manager.process_config import managed_processes # noqa: F401
except ImportError:
# Optional openpilot process configuration; ignore if openpilot is not installed.

Copilot uses AI. Check for mistakes.
pass
Comment on lines +6 to +69
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
try:
import numpy # noqa: F401
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
pass
try:
from cereal import log # noqa: F401
except ImportError:
pass
try:
from panda import Panda # noqa: F401
except ImportError:
pass
try:
from openpilot.system.manager.process_config import managed_processes # noqa: F401
except ImportError:
pass
with contextlib.suppress(ImportError):
import numpy # noqa: F401
with contextlib.suppress(ImportError):
import hypothesis # noqa: F401
with contextlib.suppress(ImportError):
import cereal
with contextlib.suppress(ImportError):
from opendbc import car # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.tools.lib.logreader import LogReader # noqa: F401
with contextlib.suppress(ImportError):
import casadi # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.common.params import Params # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.selfdrive.test import helpers # noqa: F401
with contextlib.suppress(ImportError):
import parameterized # noqa: F401
with contextlib.suppress(ImportError):
import cereal.messaging # noqa: F401
with contextlib.suppress(ImportError):
from cereal import log # noqa: F401
with contextlib.suppress(ImportError):
from panda import Panda # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.system.manager.process_config import managed_processes # noqa: F401

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +69
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
try:
import numpy # noqa: F401
except ImportError:
pass
try:
import hypothesis # noqa: F401
except ImportError:
pass
try:
import cereal
except ImportError:
pass
try:
from opendbc import car # noqa: F401
except ImportError:
pass
try:
from openpilot.tools.lib.logreader import LogReader # noqa: F401
except ImportError:
pass
try:
import casadi # noqa: F401
except ImportError:
pass
try:
from openpilot.common.params import Params # noqa: F401
except ImportError:
pass
try:
from openpilot.selfdrive.test import helpers # noqa: F401
except ImportError:
pass
try:
import parameterized # noqa: F401
except ImportError:
pass
try:
import cereal.messaging # noqa: F401
except ImportError:
pass
try:
from cereal import log # noqa: F401
except ImportError:
pass
try:
from panda import Panda # noqa: F401
except ImportError:
pass
try:
from openpilot.system.manager.process_config import managed_processes # noqa: F401
except ImportError:
pass
with contextlib.suppress(ImportError):
import numpy # noqa: F401
with contextlib.suppress(ImportError):
import hypothesis # noqa: F401
with contextlib.suppress(ImportError):
import cereal
with contextlib.suppress(ImportError):
from opendbc import car # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.tools.lib.logreader import LogReader # noqa: F401
with contextlib.suppress(ImportError):
import casadi # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.common.params import Params # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.selfdrive.test import helpers # noqa: F401
with contextlib.suppress(ImportError):
import parameterized # noqa: F401
with contextlib.suppress(ImportError):
import cereal.messaging # noqa: F401
with contextlib.suppress(ImportError):
from cereal import log # noqa: F401
with contextlib.suppress(ImportError):
from panda import Panda # noqa: F401
with contextlib.suppress(ImportError):
from openpilot.system.manager.process_config import managed_processes # noqa: F401

Copilot uses AI. Check for mistakes.

import pytest
from typing import Any

# Lazy-loaded modules for fixtures
_OpenpilotPrefix: Any = None
_manager: Any = None
_HARDWARE: Any = None


def _get_openpilot_prefix():
global _OpenpilotPrefix
if _OpenpilotPrefix is None:
from openpilot.common.prefix import OpenpilotPrefix
_OpenpilotPrefix = OpenpilotPrefix
return _OpenpilotPrefix


def _get_manager():
global _manager
if _manager is None:
from openpilot.system.manager import manager
_manager = manager
return _manager


def _get_hardware():
global _HARDWARE
if _HARDWARE is None:
from openpilot.system.hardware import HARDWARE
_HARDWARE = HARDWARE
return _HARDWARE


def _is_tici():
return os.path.isfile('/TICI')

from openpilot.common.prefix import OpenpilotPrefix
from openpilot.system.manager import manager
from openpilot.system.hardware import TICI, HARDWARE

# TODO: pytest-cpp doesn't support FAIL, and we need to create test translations in sessionstart
# pending https://github.com/pytest-dev/pytest-cpp/pull/147
Expand Down Expand Up @@ -47,6 +145,9 @@ def clean_env():

@pytest.fixture(scope="function", autouse=True)
def openpilot_function_fixture(request):
OpenpilotPrefix = _get_openpilot_prefix()
manager = _get_manager()

with clean_env():
# setup a clean environment for each test
with OpenpilotPrefix(shared_download_cache=request.node.get_closest_marker("shared_download_cache") is not None) as prefix:
Expand Down Expand Up @@ -78,6 +179,7 @@ def tici_setup_fixture(request, openpilot_function_fixture):
"""Ensure a consistent state for tests on-device. Needs the openpilot function fixture to run first."""
if 'skip_tici_setup' in request.keywords:
return
HARDWARE = _get_hardware()
HARDWARE.initialize_hardware()
HARDWARE.set_power_save(False)
os.system("pkill -9 -f athena")
Expand All @@ -86,9 +188,10 @@ def tici_setup_fixture(request, openpilot_function_fixture):
@pytest.hookimpl(tryfirst=True)
def pytest_collection_modifyitems(config, items):
skipper = pytest.mark.skip(reason="Skipping tici test on PC")
is_tici = _is_tici()
for item in items:
if "tici" in item.keywords:
if not TICI:
if not is_tici:
item.add_marker(skipper)
else:
item.fixturenames.append('tici_setup_fixture')
Expand Down
30 changes: 29 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,35 @@ allow-direct-references = true

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--ignore=openpilot/ --ignore=opendbc/ --ignore=panda/ --ignore=rednose_repo/ --ignore=tinygrad_repo/ --ignore=teleoprtc_repo/ --ignore=msgq/ -Werror --strict-config --strict-markers --durations=10 -n auto --dist=loadgroup"
addopts = "-Werror --strict-config --strict-markers --durations=10 -n auto --dist=loadgroup"
norecursedirs = [
".git",
".github",
".venv",
".vscode",
".pytest_cache",
"__pycache__",
"*.egg-info",
"build",
"dist",
"openpilot",
"opendbc",
"opendbc_repo",
"panda",
"rednose",
"rednose_repo",
"tinygrad",
"tinygrad_repo",
"teleoprtc",
"teleoprtc_repo",
"msgq",
"msgq_repo",
"third_party",
"site_scons",
"release",
"scripts",
"docs",
]
cpp_files = "test_*"
cpp_harness = "selfdrive/test/cpp_harness.py"
python_files = "test_*.py"
Expand Down