mirror of
https://github.com/esphome/esphome.git
synced 2026-09-22 04:28:43 +00:00
[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:
co-authored by
pre-commit-ci-lite[bot]
parent
445d841229
commit
03f5e4775c
@@ -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()
|
||||
Reference in New Issue
Block a user