[sensor] Defer integration imports out of module scope (#18353)

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
J. Nick Kostonandpre-commit-ci-lite[bot] authored and GitHub committed 2026-10-23 10:16:49 -10:00
1 parent 5a4025ee12
commit ebdd9fe07e
9 files changed
+48 -47

No files matched your search

+2 -2
View File
@@ -2788,8 +2788,8 @@ def test_should_run_benchmarks_core_benchmark_file_change() -> None:
def test_python_import_benchmarked_components_imports_real_components() -> None:
"""The set is what importing the real benchmark's components loads."""
loaded = determine_jobs.python_import_benchmarked_components()
# mqtt is not listed in COMPONENTS; sensor imports it at module scope
assert {"binary_sensor", "sensor", "logger", "mqtt"} <= loaded
# What else they pull in changes as imports are deferred, so only the listed ones are pinned
assert {"binary_sensor", "sensor", "logger"} <= loaded
def test_should_run_benchmarks_python_import_benchmarked_component() -> None: