Files
esphome/tests/benchmarks/python/conftest.py
J. Nick Koston 03f5e4775c [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>
2026-05-13 12:06:20 -05:00

23 lines
549 B
Python

"""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()