File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -1103,3 +1103,20 @@ def nvram_init(req):
1103
1103
assert nvram [NwkNvIds .STARTUP_OPTION ] == t .StartupOptions .ClearState .serialize ()
1104
1104
assert nvram [NwkNvIds .LOGICAL_TYPE ] == t .DeviceLogicalType .Coordinator .serialize ()
1105
1105
assert nvram [NwkNvIds .ZDO_DIRECT_CB ] == t .Bool (True ).serialize ()
1106
+
1107
+
1108
+ @pytest_mark_asyncio_timeout (seconds = 3 )
1109
+ async def test_clean_shutdown (application , mocker ):
1110
+ app , znp_server = application
1111
+
1112
+ # This should not throw
1113
+ await app .shutdown ()
1114
+
1115
+
1116
+ @pytest_mark_asyncio_timeout (seconds = 3 )
1117
+ async def test_unclean_shutdown (application , mocker ):
1118
+ app , znp_server = application
1119
+ app ._znp = None
1120
+
1121
+ # This should also not throw
1122
+ await app .shutdown ()
Original file line number Diff line number Diff line change @@ -216,7 +216,9 @@ async def shutdown(self):
216
216
"""Shutdown application."""
217
217
218
218
self ._reconnect_task .cancel ()
219
- self ._znp .close ()
219
+
220
+ if self ._znp is not None :
221
+ self ._znp .close ()
220
222
221
223
def _bind_callbacks (self , api ):
222
224
api .callback_for_response (
You can’t perform that action at this time.
0 commit comments