diff --git a/tests/rfcomm_test.py b/tests/rfcomm_test.py index fcd43108..5146c8b4 100644 --- a/tests/rfcomm_test.py +++ b/tests/rfcomm_test.py @@ -62,7 +62,7 @@ def test_frames(): # ----------------------------------------------------------------------------- @pytest.mark.asyncio -async def test_basic_connection() -> None: +async def test_connection_and_disconnection() -> None: devices = test_utils.TwoDevices() await devices.setup_connection() @@ -83,6 +83,11 @@ async def test_basic_connection() -> None: dlcs[1].write(b'Lorem ipsum dolor sit amet') assert await queues[0].get() == b'Lorem ipsum dolor sit amet' + closed = asyncio.Event() + dlcs[1].on('close', closed.set) + await dlcs[1].disconnect() + await closed.wait() + # ----------------------------------------------------------------------------- @pytest.mark.asyncio