Skip to content

Commit

Permalink
Run probe's config through device schema validation (#238)
Browse files Browse the repository at this point in the history
* Run probe's config through device schema validation.
* Update tests.
  • Loading branch information
Adminiuga authored Apr 12, 2020
1 parent 3c41cb0 commit 375ce09
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bellows/ezsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Dict

from bellows.commands import COMMANDS
from bellows.config import CONF_DEVICE_BAUDRATE, CONF_DEVICE_PATH
from bellows.config import CONF_DEVICE_BAUDRATE, CONF_DEVICE_PATH, SCHEMA_DEVICE
from bellows.exception import APIException, EzspError
import bellows.types as t
import bellows.uart as uart
Expand Down Expand Up @@ -41,7 +41,7 @@ async def connect(self) -> None:
@classmethod
async def probe(cls, device_config: Dict) -> bool:
"""Probe port for the device presence."""
ezsp = cls(device_config)
ezsp = cls(SCHEMA_DEVICE(device_config))
try:
await asyncio.wait_for(ezsp._probe(), timeout=PROBE_TIMEOUT)
return True
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ezsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import serial

DEVICE_CONFIG = {
config.CONF_DEVICE_PATH: "/dev/ttyUSB0",
config.CONF_DEVICE_PATH: "/dev/null",
config.CONF_DEVICE_BAUDRATE: 115200,
}

Expand Down

0 comments on commit 375ce09

Please sign in to comment.