[tests] Add CodSpeed benchmark for compiled-config cache fast path (#16402)

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 Koston
2026-05-13 12:06:20 -05:00
committed by GitHub
co-authored by pre-commit-ci-lite[bot]
parent 445d841229
commit 03f5e4775c
6 changed files with 209 additions and 1 deletions
+22
View File
@@ -0,0 +1,22 @@
"""Shared fixtures for the Python benchmark suite."""
from __future__ import annotations
from collections.abc import Generator
import pytest
from esphome.core import CORE
@pytest.fixture(autouse=True)
def reset_core_state() -> Generator[None]:
"""Reset CORE before and after every benchmark.
Per-iteration setups inside benchmarks reset CORE for the loop body;
this fixture handles the test-level boundary so stale state from
fixture priming doesn't leak across benchmarks.
"""
CORE.reset()
yield
CORE.reset()