Compare commits

...
2 changed files with 11 additions and 0 deletions

No files matched your search

+6
View File
@@ -20,6 +20,7 @@ from esphome.const import (
CONF_WEB_SERVER,
CONF_WIFI,
KEY_CORE,
KEY_FRAMEWORK_VERSION,
KEY_TARGET_FRAMEWORK,
KEY_TARGET_PLATFORM,
NATIVE_TOOLCHAINS,
@@ -1035,6 +1036,11 @@ class EsphomeCore:
def target_framework(self):
return self.data[KEY_CORE][KEY_TARGET_FRAMEWORK]
@property
def framework_version(self) -> Version:
"""The version of the target platform's framework, set by the platform component."""
return self.data[KEY_CORE][KEY_FRAMEWORK_VERSION]
@property
def using_arduino(self):
return self.target_framework == "arduino"
+5
View File
@@ -582,6 +582,11 @@ class TestEsphomeCore:
assert t == other
def test_framework_version(self, target: core.EsphomeCore) -> None:
version = core.Version(1, 12, 0)
target.data[const.KEY_CORE] = {const.KEY_FRAMEWORK_VERSION: version}
assert target.framework_version is version
def test_address__none(self, target):
target.config = {}
assert target.address is None