From 4440e8ee588fd8489311ae9137e8653bb2c56653 Mon Sep 17 00:00:00 2001 From: Alexei Chetroi Date: Sat, 28 Mar 2020 14:31:23 -0400 Subject: [PATCH 1/4] 0.16.0.dev0 version bump --- bellows/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bellows/__init__.py b/bellows/__init__.py index 8b2d58c7..fbf817b8 100644 --- a/bellows/__init__.py +++ b/bellows/__init__.py @@ -1,5 +1,5 @@ MAJOR_VERSION = 0 -MINOR_VERSION = 14 +MINOR_VERSION = 16 PATCH_VERSION = "0.dev0" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) From af996a817ef5d76e8277d04fb5db8ec1c004e5f2 Mon Sep 17 00:00:00 2001 From: John Ott Date: Mon, 30 Mar 2020 11:03:05 -0700 Subject: [PATCH 2/4] ezsp: fix incorrect ezsp_version reference (#226) Similar fix, looks like this got missed in refactoring --- bellows/ezsp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bellows/ezsp.py b/bellows/ezsp.py index 0c0c1e7f..9345cbc2 100644 --- a/bellows/ezsp.py +++ b/bellows/ezsp.py @@ -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) From da91c54c73a0a4c6315b113d74eaf25467b6a787 Mon Sep 17 00:00:00 2001 From: Alexei Chetroi Date: Mon, 30 Mar 2020 17:20:31 -0400 Subject: [PATCH 3/4] Update tests (#227) --- tests/test_ezsp.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/test_ezsp.py b/tests/test_ezsp.py index 09678979..bf4a4438 100644 --- a/tests/test_ezsp.py +++ b/tests/test_ezsp.py @@ -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 @@ -247,10 +251,9 @@ 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") @@ -258,9 +261,10 @@ def mockcommand(name, *args): 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): From b8377cdea0bf4a23256788a09897cae2cbfbb937 Mon Sep 17 00:00:00 2001 From: Alexei Chetroi Date: Tue, 31 Mar 2020 22:14:46 -0400 Subject: [PATCH 4/4] 0.15.1 version bump --- bellows/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bellows/__init__.py b/bellows/__init__.py index fbf817b8..f8be0de2 100644 --- a/bellows/__init__.py +++ b/bellows/__init__.py @@ -1,5 +1,5 @@ MAJOR_VERSION = 0 -MINOR_VERSION = 16 -PATCH_VERSION = "0.dev0" +MINOR_VERSION = 15 +PATCH_VERSION = "1" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION)