Skip to content

Commit b658bc1

Browse files
authored
Fix tests broken by zigpy update (#246)
* Fix watchdog test * Use mock patch annotation for watchdog period * Fix TSNs * Re-add sleep to make sure watchdog loop has enough time for 5 "feeds"
1 parent 7171c6a commit b658bc1

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

tests/application/test_connect.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,13 @@ async def test_disconnect_failure(device, make_application):
201201

202202

203203
@pytest.mark.parametrize("device", [FormedLaunchpadCC26X2R1])
204+
@patch("zigpy_znp.zigbee.application.ControllerApplication._watchdog_period", new=0.1)
204205
async def test_watchdog(device, make_application):
205206
app, znp_server = make_application(server_cls=device)
206-
await app.startup(auto_form=False)
207-
208207
app._watchdog_feed = AsyncMock(wraps=app._watchdog_feed)
209208

210-
with patch("zigpy.application.ControllerApplication._watchdog_period", new=0.1):
211-
await asyncio.sleep(0.6)
212-
209+
await app.startup(auto_form=False)
210+
await asyncio.sleep(0.6)
213211
assert len(app._watchdog_feed.mock_calls) >= 5
214212

215213
await app.shutdown()

tests/application/test_joining.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async def test_permit_join(device, mocker, make_application):
4040
request=zdo_request_matcher(
4141
dst_addr=t.AddrModeAddress(t.AddrMode.Broadcast, 0xFFFC),
4242
command_id=zdo_t.ZDOCmd.Mgmt_Permit_Joining_req,
43-
TSN=7,
43+
TSN=2,
4444
zdo_PermitDuration=10,
4545
zdo_TC_Significant=0,
4646
),
@@ -117,7 +117,7 @@ async def test_join_device(device, make_application):
117117
IsBroadcast=t.Bool.false,
118118
ClusterId=32822,
119119
SecurityUse=0,
120-
TSN=7,
120+
TSN=1,
121121
MacDst=0x0000,
122122
Data=b"\x00",
123123
),

tests/application/test_requests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async def test_zigpy_request(device, make_application):
5151
app, znp_server = make_application(device)
5252
await app.startup(auto_form=False)
5353

54-
TSN = 7
54+
TSN = 1
5555

5656
device = app.add_initialized_device(ieee=t.EUI64(range(8)), nwk=0xAABB)
5757

@@ -111,7 +111,7 @@ async def test_zigpy_request_failure(device, make_application, mocker):
111111
app, znp_server = make_application(device)
112112
await app.startup(auto_form=False)
113113

114-
TSN = 7
114+
TSN = 1
115115

116116
device = app.add_initialized_device(ieee=t.EUI64(range(8)), nwk=0xAABB)
117117

@@ -456,7 +456,7 @@ async def inner():
456456

457457
@pytest.mark.parametrize("device", [FormedLaunchpadCC26X2R1])
458458
async def test_request_recovery_route_rediscovery_zdo(device, make_application, mocker):
459-
TSN = 7
459+
TSN = 1
460460

461461
app, znp_server = make_application(server_cls=device)
462462

0 commit comments

Comments
 (0)