Skip to content

Commit 03fe973

Browse files
authored
Add ControllerApplication.shutdown() method. (#33)
1 parent 452fc19 commit 03fe973

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

tests/test_application.py

+7
Original file line numberDiff line numberDiff line change
@@ -490,3 +490,10 @@ def test_handle_reply_unexpected(app):
490490
@pytest.mark.asyncio
491491
async def test_force_remove(app):
492492
await app.force_remove(mock.sentinel.device)
493+
494+
495+
@pytest.mark.asyncio
496+
async def test_shutdown(app):
497+
app._api.close = mock.MagicMock()
498+
await app.shutdown()
499+
assert app._api.close.call_count == 1

zigpy_xbee/zigbee/application.py

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ def __init__(self, api, database_file=None):
2424
self._pending = {}
2525
self._nwk = 0
2626

27+
async def shutdown(self):
28+
"""Shutdown application."""
29+
self._api.close()
30+
2731
async def startup(self, auto_form=False):
2832
"""Perform a complete application startup"""
2933
try:

0 commit comments

Comments
 (0)