mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 13:43:00 +00:00
[core] cpp tests: Allow customizing code generation during tests (#14681)
Co-authored-by: J. Nick Koston <nick@home-assistant.io> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
7
tests/benchmarks/components/core/__init__.py
Normal file
7
tests/benchmarks/components/core/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from tests.testing_helpers import ComponentManifestOverride
|
||||
|
||||
|
||||
def override_manifest(manifest: ComponentManifestOverride) -> None:
|
||||
# core (esphome/core/config.py) must run its to_code during builds
|
||||
# because it bootstraps the fundamental application infrastructure.
|
||||
manifest.enable_codegen()
|
||||
7
tests/benchmarks/components/host/__init__.py
Normal file
7
tests/benchmarks/components/host/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from tests.testing_helpers import ComponentManifestOverride
|
||||
|
||||
|
||||
def override_manifest(manifest: ComponentManifestOverride) -> None:
|
||||
# host must run its to_code during builds because it sets up
|
||||
# the host platform target execution environment.
|
||||
manifest.enable_codegen()
|
||||
7
tests/benchmarks/components/json/__init__.py
Normal file
7
tests/benchmarks/components/json/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from tests.testing_helpers import ComponentManifestOverride
|
||||
|
||||
|
||||
def override_manifest(manifest: ComponentManifestOverride) -> None:
|
||||
# json must run its to_code during benchmark builds because it
|
||||
# adds the ArduinoJson library dependency needed by the API component.
|
||||
manifest.enable_codegen()
|
||||
7
tests/benchmarks/components/logger/__init__.py
Normal file
7
tests/benchmarks/components/logger/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from tests.testing_helpers import ComponentManifestOverride
|
||||
|
||||
|
||||
def override_manifest(manifest: ComponentManifestOverride) -> None:
|
||||
# logger must run its to_code during builds because it configures
|
||||
# the logging subsystem used by ESP_LOG* macros.
|
||||
manifest.enable_codegen()
|
||||
9
tests/benchmarks/components/time/__init__.py
Normal file
9
tests/benchmarks/components/time/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import esphome.codegen as cg
|
||||
from tests.testing_helpers import ComponentManifestOverride
|
||||
|
||||
|
||||
def override_manifest(manifest: ComponentManifestOverride) -> None:
|
||||
async def to_code(config):
|
||||
cg.add_build_flag("-DUSE_TIME_TIMEZONE")
|
||||
|
||||
manifest.to_code = to_code
|
||||
Reference in New Issue
Block a user