Skip to content

Commit f5f9d6f

Browse files
authored
replace pyserial-asyncio with pyserial-asyncio-fast (#178)
* replace pyserial-asyncio with pyserial-asyncio-fast * fix CI * fix async tests
1 parent c2d2f5b commit f5f9d6f

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ jobs:
1111
with:
1212
CODE_FOLDER: zigpy_xbee
1313
CACHE_VERSION: 2
14-
PYTHON_VERSION_DEFAULT: 3.9.15
15-
PRE_COMMIT_CACHE_PATH: ~/.cache/pre-commit
1614
MINIMUM_COVERAGE_PERCENTAGE: 100
1715
secrets:
1816
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

tests/test_api.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def _handle_at_response(api, tsn, status, at_response=b""):
323323
return response
324324

325325

326-
def test_handle_at_response_none(api):
326+
async def test_handle_at_response_none(api):
327327
"""Test AT successful response with no value."""
328328
tsn = 123
329329
fut = _handle_at_response(api, tsn, 0)
@@ -332,7 +332,7 @@ def test_handle_at_response_none(api):
332332
assert fut.exception() is None
333333

334334

335-
def test_handle_at_response_data(api):
335+
async def test_handle_at_response_data(api):
336336
"""Test AT successful response with data."""
337337
tsn = 123
338338
status, response = 0, 0x23
@@ -342,7 +342,7 @@ def test_handle_at_response_data(api):
342342
assert fut.exception() is None
343343

344344

345-
def test_handle_at_response_error(api):
345+
async def test_handle_at_response_error(api):
346346
"""Test AT unsuccessful response."""
347347
tsn = 123
348348
status, response = 1, 0x23
@@ -351,7 +351,7 @@ def test_handle_at_response_error(api):
351351
assert isinstance(fut.exception(), ATCommandError)
352352

353353

354-
def test_handle_at_response_invalid_command(api):
354+
async def test_handle_at_response_invalid_command(api):
355355
"""Test invalid AT command response."""
356356
tsn = 123
357357
status, response = 2, 0x23
@@ -360,7 +360,7 @@ def test_handle_at_response_invalid_command(api):
360360
assert isinstance(fut.exception(), InvalidCommand)
361361

362362

363-
def test_handle_at_response_undef_error(api):
363+
async def test_handle_at_response_undef_error(api):
364364
"""Test AT unsuccessful response with undefined error."""
365365
tsn = 123
366366
status, response = 0xEE, 0x23
@@ -482,7 +482,7 @@ def test_handle_tx_status_duplicate(api):
482482
assert send_fut.set_exception.call_count == 0
483483

484484

485-
def test_handle_registration_status(api):
485+
async def test_handle_registration_status(api):
486486
"""Test device registration status."""
487487
frame_id = 0x12
488488
status = xbee_t.RegistrationStatus.SUCCESS
@@ -526,7 +526,7 @@ async def test_command_mode_at_cmd_timeout(api):
526526
assert result is None
527527

528528

529-
def test_handle_command_mode_rsp(api):
529+
async def test_handle_command_mode_rsp(api):
530530
"""Test command mode response."""
531531
api._cmd_mode_future = None
532532
data = "OK"

tests/test_uart.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from unittest import mock
55

66
import pytest
7-
import serial_asyncio
7+
import serial_asyncio_fast
88
import zigpy.config
99

1010
from zigpy_xbee import uart
@@ -22,7 +22,7 @@ def gw():
2222
"""Gateway fixture."""
2323
gw = uart.Gateway(mock.MagicMock())
2424
gw._transport = mock.MagicMock()
25-
gw._transport.serial.BAUDRATES = serial_asyncio.serial.Serial.BAUDRATES
25+
gw._transport.serial.BAUDRATES = serial_asyncio_fast.serial.Serial.BAUDRATES
2626
return gw
2727

2828

@@ -48,7 +48,7 @@ async def mock_conn(loop, protocol_factory, **kwargs):
4848
loop.call_soon(protocol.connection_made, None)
4949
return None, protocol
5050

51-
monkeypatch.setattr(serial_asyncio, "create_serial_connection", mock_conn)
51+
monkeypatch.setattr(serial_asyncio_fast, "create_serial_connection", mock_conn)
5252

5353
await uart.connect(DEVICE_CONFIG, api)
5454

0 commit comments

Comments
 (0)