Skip to content

Commit cf5673a

Browse files
committed
Fix test flakiness, attempt 3
1 parent b8269e9 commit cf5673a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

tests/application/test_joining.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ async def test_on_zdo_device_join(device, make_application, mocker):
205205

206206
app.handle_join.assert_called_once_with(nwk=nwk, ieee=ieee, parent_nwk=0x0001)
207207

208+
app.get_device(nwk=0x1234).cancel_initialization()
209+
208210
await app.shutdown()
209211

210212

@@ -269,9 +271,6 @@ async def test_on_zdo_device_join_and_announce_fast(device, make_application, mo
269271
app.get_device(ieee=ieee).cancel_initialization()
270272
await app.shutdown()
271273

272-
with pytest.raises(asyncio.CancelledError):
273-
await app.get_device(ieee=ieee)._initialize_task
274-
275274

276275
@mock.patch("zigpy_znp.zigbee.application.DEVICE_JOIN_MAX_DELAY", new=0.1)
277276
@mock.patch(

zigpy_znp/zigbee/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def on_zdo_tc_device_join(self, msg: c.ZDO.TCDevInd.Callback) -> None:
490490

491491
# Perform route discovery (just in case) when a device joins the network so that
492492
# we can begin initialization as soon as possible.
493-
asyncio.create_task(self._discover_route(msg.SrcNwk))
493+
self.create_task(self._discover_route(msg.SrcNwk))
494494

495495
if msg.SrcIEEE in self._join_announce_tasks:
496496
self._join_announce_tasks.pop(msg.SrcIEEE).cancel()

0 commit comments

Comments
 (0)