1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 14:43:51 +00:00

Add pytest to CI (#1138)

This commit is contained in:
Otto Winter
2020-07-15 14:00:02 +02:00
committed by GitHub
parent a20e71b32a
commit d5c59292c8
7 changed files with 120 additions and 39 deletions

View File

@@ -493,9 +493,9 @@ class EsphomeCore:
# The board that's used (for example nodemcuv2)
self.board: Optional[str] = None
# The full raw configuration
self.raw_config: ConfigType = {}
self.raw_config: Optional[ConfigType] = None
# The validated configuration, this is None until the config has been validated
self.config: ConfigType = {}
self.config: Optional[ConfigType] = None
# The pending tasks in the task queue (mostly for C++ generation)
# This is a priority queue (with heapq)
# Each item is a tuple of form: (-priority, unique number, task)
@@ -547,6 +547,10 @@ class EsphomeCore:
@property
def address(self) -> Optional[str]:
if self.config is None:
raise ValueError("Config has not been loaded yet")
# pylint: disable=unsupported-membership-test,unsubscriptable-object
if 'wifi' in self.config:
return self.config[CONF_WIFI][CONF_USE_ADDRESS]
@@ -557,6 +561,10 @@ class EsphomeCore:
@property
def comment(self) -> Optional[str]:
if self.config is None:
raise ValueError("Config has not been loaded yet")
# pylint: disable=unsubscriptable-object
if CONF_COMMENT in self.config[CONF_ESPHOME]:
return self.config[CONF_ESPHOME][CONF_COMMENT]
@@ -570,6 +578,10 @@ class EsphomeCore:
@property
def arduino_version(self) -> str:
if self.config is None:
raise ValueError("Config has not been loaded yet")
# pylint: disable=unsubscriptable-object
return self.config[CONF_ESPHOME][CONF_ARDUINO_VERSION]
@property

View File

@@ -256,16 +256,20 @@ ESP32_BOARD_PINS = {
def _lookup_pin(value):
if CORE.is_esp8266:
board_pins = ESP8266_BOARD_PINS.get(CORE.board, {})
board_pins_dict = ESP8266_BOARD_PINS
base_pins = ESP8266_BASE_PINS
elif CORE.is_esp32:
board_pins = ESP32_BOARD_PINS.get(CORE.board, {})
board_pins_dict = ESP32_BOARD_PINS
base_pins = ESP32_BASE_PINS
else:
raise NotImplementedError
board_pins = board_pins_dict.get(CORE.board, {})
# Resolved aliased board pins (shorthand when two boards have the same pin configuration)
while isinstance(board_pins, str):
board_pins = ESP8266_BOARD_PINS.get(board_pins, {})
board_pins = board_pins_dict[board_pins]
if value in board_pins:
return board_pins[value]
if value in base_pins: