Skip to content

Commit

Permalink
0.15.1 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Adminiuga authored Apr 1, 2020
2 parents cc040e7 + da3eecb commit 13f96c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bellows/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MAJOR_VERSION = 0
MINOR_VERSION = 15
PATCH_VERSION = "0"
PATCH_VERSION = "1"
__short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION)
__version__ = "{}.{}".format(__short_version__, PATCH_VERSION)
2 changes: 1 addition & 1 deletion bellows/ezsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def version(self):
ver, stack_type, stack_version = await self._command(
"version", self.ezsp_version
)
if ver != self.version:
if ver != self.ezsp_version:
self._ezsp_version = ver
await self._command("version", ver)
LOGGER.debug("Switched to EZSP protocol version %d", self.ezsp_version)
Expand Down
20 changes: 12 additions & 8 deletions tests/test_ezsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@ def test_non_existent_attr_with_list(ezsp_f):
ezsp_f.__getattr__(("unexpectedly", "hah"))


def test_command(ezsp_f):
@pytest.mark.asyncio
async def test_command(ezsp_f):
ezsp_f._gw = mock.MagicMock()

ezsp_f.start_ezsp()
ezsp_f._command("version")
coro = ezsp_f._command("nop")
ezsp_f._awaiting[ezsp_f._seq - 1][2].set_result(True)
await coro
assert ezsp_f._gw.data.call_count == 1


Expand Down Expand Up @@ -247,20 +251,20 @@ def test_callback_exc(ezsp_f):
assert testcb.call_count == 1


def test_change_version(ezsp_f):
loop = asyncio.get_event_loop()
version = 5

@pytest.mark.asyncio
@pytest.mark.parametrize("version, call_count", ((4, 1), (5, 2), (6, 2)))
async def test_change_version(ezsp_f, version, call_count):
def mockcommand(name, *args):
assert name == "version"
ezsp_f.frame_received(b"\x01\x00\x1b")
fut = asyncio.Future()
fut.set_result([version, 2, 2046])
return fut

ezsp_f._command = mockcommand
loop.run_until_complete(ezsp_f.version())
ezsp_f._command = mock.MagicMock(side_effect=mockcommand)
await ezsp_f.version()
assert ezsp_f.ezsp_version == version
assert ezsp_f._command.call_count == call_count


def test_stop_ezsp(ezsp_f):
Expand Down

0 comments on commit 13f96c8

Please sign in to comment.