-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure version-specific unit tests cover command sending format (#639)
* Use the correct kwarg when sending `setPolicy` * Ensure mocked EZSP functions enforce their signature * Migrate v4 * Migrate v5 * Migrate v6 * Migrate v7 * Migrate v9 * Migrate v10 * Migarte 11 * Migrate v12 * Migrate v13 * Migrate v14 * Fix v7 import * Ensure application unit tests mock as little of EZSP as possible * Avoid mocking EZSP when testing multicast * Explicitly stop EZSP in unit test testing for stopped EZSP * Test no-op `add_transient_link_key` * Oops * Fix all slow unit tests * Use `call_count` instead of `await_count` * Revert "Use `call_count` instead of `await_count`" This reverts commit 8752c61. * Try `sleep` :) * Revert "Try `sleep` :)" This reverts commit 2a5afc1. * Fix flaky test (hopefully)
- Loading branch information
Showing
21 changed files
with
436 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from __future__ import annotations | ||
|
||
from unittest.mock import AsyncMock | ||
|
||
from bellows.ezsp.protocol import ProtocolHandler | ||
|
||
|
||
def mock_ezsp_commands(ezsp: ProtocolHandler) -> ProtocolHandler: | ||
for command_name, (_command_id, tx_schema, _rx_schema) in ezsp.COMMANDS.items(): | ||
# TODO: make this end-to-end instead of relying on this serialization hack | ||
async def fake_sender(*args, _command_name=command_name, _ezsp=ezsp, **kwargs): | ||
# Trigger an exception early | ||
_ezsp._ezsp_frame(_command_name, *args, **kwargs) | ||
|
||
setattr(ezsp, command_name, AsyncMock(wraps=fake_sender)) |
Oops, something went wrong.