Skip to content

Commit 9d5d738

Browse files
committed
Make make_application synchronous
1 parent 4162385 commit 9d5d738

File tree

7 files changed

+56
-56
lines changed

7 files changed

+56
-56
lines changed

tests/application/test_connect.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ async def test_probe_multiple(device, make_znp_server):
120120

121121
@pytest.mark.parametrize("device", FORMED_DEVICES)
122122
async def test_reconnect(device, make_application):
123-
app, znp_server = await make_application(
123+
app, znp_server = make_application(
124124
server_cls=device,
125125
client_config={
126126
# Make auto-reconnection happen really fast
@@ -162,7 +162,7 @@ async def test_reconnect(device, make_application):
162162

163163
@pytest.mark.parametrize("device", FORMED_DEVICES)
164164
async def test_shutdown_from_app(device, mocker, make_application):
165-
app, znp_server = await make_application(server_cls=device)
165+
app, znp_server = make_application(server_cls=device)
166166

167167
await app.startup(auto_form=False)
168168

@@ -178,7 +178,7 @@ async def test_shutdown_from_app(device, mocker, make_application):
178178

179179

180180
async def test_clean_shutdown(make_application):
181-
app, znp_server = await make_application(server_cls=FormedLaunchpadCC26X2R1)
181+
app, znp_server = make_application(server_cls=FormedLaunchpadCC26X2R1)
182182
await app.startup(auto_form=False)
183183

184184
# This should not throw
@@ -189,7 +189,7 @@ async def test_clean_shutdown(make_application):
189189

190190

191191
async def test_multiple_shutdown(make_application):
192-
app, znp_server = await make_application(server_cls=FormedLaunchpadCC26X2R1)
192+
app, znp_server = make_application(server_cls=FormedLaunchpadCC26X2R1)
193193
await app.startup(auto_form=False)
194194

195195
await app.shutdown()
@@ -201,7 +201,7 @@ async def test_multiple_shutdown(make_application):
201201
async def test_reconnect_lockup(device, make_application, mocker):
202202
mocker.patch("zigpy_znp.zigbee.application.WATCHDOG_PERIOD", 0.1)
203203

204-
app, znp_server = await make_application(
204+
app, znp_server = make_application(
205205
server_cls=device,
206206
client_config={
207207
# Make auto-reconnection happen really fast
@@ -242,7 +242,7 @@ async def test_reconnect_lockup(device, make_application, mocker):
242242
async def test_reconnect_lockup_pyserial(device, make_application, mocker):
243243
mocker.patch("zigpy_znp.zigbee.application.WATCHDOG_PERIOD", 0.1)
244244

245-
app, znp_server = await make_application(
245+
app, znp_server = make_application(
246246
server_cls=device,
247247
client_config={
248248
conf.CONF_ZNP_CONFIG: {
@@ -293,7 +293,7 @@ async def patched_start_network(old_start_network=app.start_network, **kwargs):
293293

294294
@pytest.mark.parametrize("device", [FormedLaunchpadCC26X2R1])
295295
async def test_disconnect(device, make_application):
296-
app, znp_server = await make_application(
296+
app, znp_server = make_application(
297297
server_cls=device,
298298
client_config={
299299
conf.CONF_ZNP_CONFIG: {
@@ -316,7 +316,7 @@ async def test_disconnect(device, make_application):
316316

317317
@pytest.mark.parametrize("device", [FormedLaunchpadCC26X2R1])
318318
async def test_disconnect_failure(device, make_application):
319-
app, znp_server = await make_application(
319+
app, znp_server = make_application(
320320
server_cls=device,
321321
client_config={
322322
conf.CONF_ZNP_CONFIG: {

tests/application/test_joining.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
@pytest.mark.parametrize("device", FORMED_DEVICES)
2323
async def test_permit_join(device, mocker, make_application):
24-
app, znp_server = await make_application(server_cls=device)
24+
app, znp_server = make_application(server_cls=device)
2525

2626
permit_join_coordinator = znp_server.reply_once_to(
2727
request=c.ZDO.MgmtPermitJoinReq.Req(
@@ -74,7 +74,7 @@ async def test_permit_join(device, mocker, make_application):
7474

7575
@pytest.mark.parametrize("device", FORMED_DEVICES)
7676
async def test_join_coordinator(device, make_application):
77-
app, znp_server = await make_application(server_cls=device)
77+
app, znp_server = make_application(server_cls=device)
7878

7979
# Handle us opening joins on the coordinator
8080
permit_join_coordinator = znp_server.reply_once_to(
@@ -100,7 +100,7 @@ async def test_join_device(device, make_application):
100100
ieee = t.EUI64.convert("EC:1B:BD:FF:FE:54:4F:40")
101101
nwk = 0x1234
102102

103-
app, znp_server = await make_application(server_cls=device)
103+
app, znp_server = make_application(server_cls=device)
104104
device = app.add_initialized_device(ieee=ieee, nwk=nwk)
105105

106106
permit_join = znp_server.reply_once_to(
@@ -133,7 +133,7 @@ async def test_join_device(device, make_application):
133133
@pytest.mark.parametrize("device", FORMED_ZSTACK3_DEVICES)
134134
@pytest.mark.parametrize("permit_result", [None, asyncio.TimeoutError()])
135135
async def test_permit_join_with_key(device, permit_result, make_application, mocker):
136-
app, znp_server = await make_application(server_cls=device)
136+
app, znp_server = make_application(server_cls=device)
137137

138138
# Consciot bulb
139139
ieee = t.EUI64.convert("EC:1B:BD:FF:FE:54:4F:40")
@@ -183,7 +183,7 @@ async def test_permit_join_with_key(device, permit_result, make_application, moc
183183

184184
@pytest.mark.parametrize("device", FORMED_ZSTACK3_DEVICES)
185185
async def test_permit_join_with_invalid_key(device, make_application):
186-
app, znp_server = await make_application(server_cls=device)
186+
app, znp_server = make_application(server_cls=device)
187187

188188
# Consciot bulb
189189
ieee = t.EUI64.convert("EC:1B:BD:FF:FE:54:4F:40")
@@ -197,7 +197,7 @@ async def test_permit_join_with_invalid_key(device, make_application):
197197

198198
@pytest.mark.parametrize("device", FORMED_DEVICES)
199199
async def test_on_zdo_device_join(device, make_application, mocker):
200-
app, znp_server = await make_application(server_cls=device)
200+
app, znp_server = make_application(server_cls=device)
201201
await app.startup(auto_form=False)
202202

203203
mocker.patch.object(app, "handle_join", wraps=app.handle_join)
@@ -217,7 +217,7 @@ async def test_on_zdo_device_join(device, make_application, mocker):
217217

218218
@pytest.mark.parametrize("device", FORMED_DEVICES)
219219
async def test_on_zdo_device_join_and_announce_fast(device, make_application, mocker):
220-
app, znp_server = await make_application(server_cls=device)
220+
app, znp_server = make_application(server_cls=device)
221221
await app.startup(auto_form=False)
222222

223223
mocker.patch.object(app, "handle_join", wraps=app.handle_join)
@@ -274,7 +274,7 @@ async def test_on_zdo_device_join_and_announce_fast(device, make_application, mo
274274

275275
@pytest.mark.parametrize("device", FORMED_DEVICES)
276276
async def test_on_zdo_device_join_and_announce_slow(device, make_application, mocker):
277-
app, znp_server = await make_application(server_cls=device)
277+
app, znp_server = make_application(server_cls=device)
278278
await app.startup(auto_form=False)
279279

280280
znp_server.reply_to(

tests/application/test_requests.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
@pytest.mark.parametrize("device", [FormedLaunchpadCC26X2R1])
2525
async def test_chosen_dst_endpoint(device, make_application, mocker):
26-
app, znp_server = await make_application(device)
26+
app, znp_server = make_application(device)
2727
await app.startup(auto_form=False)
2828

2929
build = mocker.patch.object(type(app), "_zstack_build_id", mocker.PropertyMock())
@@ -48,7 +48,7 @@ async def test_chosen_dst_endpoint(device, make_application, mocker):
4848

4949
@pytest.mark.parametrize("device", FORMED_DEVICES)
5050
async def test_zigpy_request(device, make_application):
51-
app, znp_server = await make_application(device)
51+
app, znp_server = make_application(device)
5252
await app.startup(auto_form=False)
5353

5454
TSN = 7
@@ -108,7 +108,7 @@ async def test_zigpy_request(device, make_application):
108108

109109
@pytest.mark.parametrize("device", FORMED_DEVICES)
110110
async def test_zigpy_request_failure(device, make_application, mocker):
111-
app, znp_server = await make_application(device)
111+
app, znp_server = make_application(device)
112112
await app.startup(auto_form=False)
113113

114114
TSN = 7
@@ -161,7 +161,7 @@ async def test_zigpy_request_failure(device, make_application, mocker):
161161
],
162162
)
163163
async def test_request_addr_mode(device, addr, make_application, mocker):
164-
app, znp_server = await make_application(server_cls=device)
164+
app, znp_server = make_application(server_cls=device)
165165

166166
await app.startup(auto_form=False)
167167

@@ -188,7 +188,7 @@ async def test_request_addr_mode(device, addr, make_application, mocker):
188188

189189
@pytest.mark.parametrize("device", FORMED_DEVICES)
190190
async def test_mrequest(device, make_application, mocker):
191-
app, znp_server = await make_application(server_cls=device)
191+
app, znp_server = make_application(server_cls=device)
192192

193193
mocker.patch.object(app, "send_packet", new=CoroutineMock())
194194
group = app.groups.add_group(0x1234, "test group")
@@ -207,7 +207,7 @@ async def test_mrequest(device, make_application, mocker):
207207

208208
@pytest.mark.parametrize("device", [FormedLaunchpadCC26X2R1])
209209
async def test_mrequest_doesnt_block(device, make_application, event_loop):
210-
app, znp_server = await make_application(server_cls=device)
210+
app, znp_server = make_application(server_cls=device)
211211

212212
znp_server.reply_once_to(
213213
request=c.AF.DataRequestExt.Req(
@@ -240,7 +240,7 @@ async def test_mrequest_doesnt_block(device, make_application, event_loop):
240240

241241
@pytest.mark.parametrize("device", [FormedLaunchpadCC26X2R1])
242242
async def test_broadcast(device, make_application, mocker):
243-
app, znp_server = await make_application(server_cls=device)
243+
app, znp_server = make_application(server_cls=device)
244244
await app.startup()
245245

246246
znp_server.reply_once_to(
@@ -277,7 +277,7 @@ async def test_broadcast(device, make_application, mocker):
277277

278278
@pytest.mark.parametrize("device", [FormedLaunchpadCC26X2R1])
279279
async def test_request_concurrency(device, make_application, mocker):
280-
app, znp_server = await make_application(
280+
app, znp_server = make_application(
281281
server_cls=device,
282282
client_config={conf.CONF_MAX_CONCURRENT_REQUESTS: 2},
283283
)
@@ -344,7 +344,7 @@ async def callback(req):
344344

345345
@pytest.mark.parametrize("device", FORMED_DEVICES)
346346
async def test_nonstandard_profile(device, make_application):
347-
app, znp_server = await make_application(server_cls=device)
347+
app, znp_server = make_application(server_cls=device)
348348
await app.startup(auto_form=False)
349349

350350
device = app.add_initialized_device(ieee=t.EUI64(range(8)), nwk=0xFA9E)
@@ -401,7 +401,7 @@ async def test_nonstandard_profile(device, make_application):
401401
async def test_request_cancellation_shielding(
402402
device, make_application, mocker, event_loop
403403
):
404-
app, znp_server = await make_application(server_cls=device)
404+
app, znp_server = make_application(server_cls=device)
405405

406406
await app.startup(auto_form=False)
407407

@@ -458,7 +458,7 @@ async def inner():
458458
async def test_request_recovery_route_rediscovery_zdo(device, make_application, mocker):
459459
TSN = 7
460460

461-
app, znp_server = await make_application(server_cls=device)
461+
app, znp_server = make_application(server_cls=device)
462462

463463
await app.startup(auto_form=False)
464464

@@ -539,7 +539,7 @@ def set_route_discovered(req):
539539

540540
@pytest.mark.parametrize("device", [FormedLaunchpadCC26X2R1])
541541
async def test_request_recovery_route_rediscovery_af(device, make_application, mocker):
542-
app, znp_server = await make_application(server_cls=device)
542+
app, znp_server = make_application(server_cls=device)
543543

544544
await app.startup(auto_form=False)
545545

@@ -608,7 +608,7 @@ def set_route_discovered(req):
608608

609609
@pytest.mark.parametrize("device", [FormedLaunchpadCC26X2R1])
610610
async def test_request_recovery_use_ieee_addr(device, make_application, mocker):
611-
app, znp_server = await make_application(server_cls=device)
611+
app, znp_server = make_application(server_cls=device)
612612

613613
await app.startup(auto_form=False)
614614

@@ -676,7 +676,7 @@ def data_confirm_replier(req):
676676
async def test_request_recovery_assoc_remove(
677677
device_cls, fw_assoc_remove, final_status, make_application, mocker
678678
):
679-
app, znp_server = await make_application(server_cls=device_cls)
679+
app, znp_server = make_application(server_cls=device_cls)
680680

681681
await app.startup(auto_form=False)
682682

@@ -810,7 +810,7 @@ def assoc_remove(req):
810810
async def test_request_recovery_manual_source_route(
811811
device, succeed, relays, make_application, mocker
812812
):
813-
app, znp_server = await make_application(server_cls=device)
813+
app, znp_server = make_application(server_cls=device)
814814

815815
await app.startup(auto_form=False)
816816

@@ -884,7 +884,7 @@ def data_confirm_replier(req):
884884

885885
@pytest.mark.parametrize("device", [FormedLaunchpadCC26X2R1])
886886
async def test_route_discovery_concurrency(device, make_application):
887-
app, znp_server = await make_application(server_cls=device)
887+
app, znp_server = make_application(server_cls=device)
888888

889889
await app.startup(auto_form=False)
890890

@@ -921,7 +921,7 @@ async def test_route_discovery_concurrency(device, make_application):
921921

922922
@pytest.mark.parametrize("device", FORMED_DEVICES)
923923
async def test_send_security_and_packet_source_route(device, make_application, mocker):
924-
app, znp_server = await make_application(server_cls=device)
924+
app, znp_server = make_application(server_cls=device)
925925
await app.startup(auto_form=False)
926926

927927
packet = zigpy_t.ZigbeePacket(
@@ -972,7 +972,7 @@ async def test_send_security_and_packet_source_route(device, make_application, m
972972

973973
@pytest.mark.parametrize("device", FORMED_DEVICES)
974974
async def test_send_packet_failure(device, make_application, mocker):
975-
app, znp_server = await make_application(server_cls=device)
975+
app, znp_server = make_application(server_cls=device)
976976
await app.startup(auto_form=False)
977977

978978
packet = zigpy_t.ZigbeePacket(
@@ -1013,7 +1013,7 @@ async def test_send_packet_failure(device, make_application, mocker):
10131013

10141014
@pytest.mark.parametrize("device", FORMED_DEVICES)
10151015
async def test_send_packet_failure_disconnected(device, make_application, mocker):
1016-
app, znp_server = await make_application(server_cls=device)
1016+
app, znp_server = make_application(server_cls=device)
10171017
await app.startup(auto_form=False)
10181018

10191019
app._znp = None

0 commit comments

Comments
 (0)