Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,8 @@ def test_tx_confirm_dup(app, caplog):
assert "probably duplicate response" in caplog.text


def test_tx_confirm_unexpcted(app, caplog):
def test_tx_confirm_unexpcted(app):
app.handle_tx_confirm(123, 0x00)
assert any(r.levelname == "WARNING" for r in caplog.records)
assert "Unexpected transmit confirm for request id" in caplog.text


async def test_reset_watchdog(app):
Expand Down
7 changes: 7 additions & 0 deletions tests/test_send_receive.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,10 @@ async def test_send_packet_deliver_failure(app, tx_packet): # noqa: F811
await app.send_packet(tx_packet)

assert "Failed to deliver" in str(e)


async def test_send_packet_no_ack_ignores_deliver_failure(app, tx_packet): # noqa: F811
tx_packet.tx_options &= ~zigpy_t.TransmitOptions.ACK
with patch_data_request(app, fail_deliver=True):
await app.send_packet(tx_packet)
assert len(app._pending_requests) == 0
20 changes: 10 additions & 10 deletions zigpy_deconz/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,14 +583,14 @@ async def send_packet(self, packet):
raise zigpy.exceptions.DeliveryError(
f"Failed to enqueue packet: {ex!r}", ex.status
)

async with asyncio_timeout(SEND_CONFIRM_TIMEOUT):
status = await future

if status != TXStatus.SUCCESS:
raise zigpy.exceptions.DeliveryError(
f"Failed to deliver packet: {status!r}", status
)
if tx_options & t.DeconzTransmitOptions.USE_APS_ACKS:
async with asyncio_timeout(SEND_CONFIRM_TIMEOUT):
status = await future

if status != TXStatus.SUCCESS:
raise zigpy.exceptions.DeliveryError(
f"Failed to deliver packet: {status!r}", status
)
finally:
del self._pending_requests[req_id]

Expand All @@ -602,8 +602,8 @@ def handle_tx_confirm(self, req_id, status):
try:
future = self._pending_requests[req_id]
except KeyError:
LOGGER.warning(
"Unexpected transmit confirm for request id %s, Status: %s",
LOGGER.debug(
"Transmit confirm for request id %s, Status: %s",
req_id,
status,
)
Expand Down
Loading