File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 3636from . import mqtt_packet
3737from .conftest import QUEUE_TIMEOUT
3838
39+ RELEASE_TIMEOUT = 2
40+
3941
4042@pytest .fixture (name = "a01_mqtt_client" )
4143async def a01_mqtt_client_fixture (
@@ -59,9 +61,11 @@ async def a01_mqtt_client_fixture(
5961 try :
6062 yield client
6163 finally :
62- if not client .is_connected ():
64+ # Cleanup is best effort to reduce number of active threads
65+ if client .is_connected ():
6366 try :
64- await client .async_release ()
67+ async with asyncio .timeout (RELEASE_TIMEOUT ):
68+ await client .async_release ()
6569 except Exception :
6670 pass
6771
@@ -207,8 +211,8 @@ async def test_set_value(
207211 """Test sending an arbitrary MQTT message and parsing the response."""
208212 # Clear existing messages received during setup
209213 assert received_requests .qsize () == 2
210- assert received_requests .get (block = True )
211- assert received_requests .get (block = True )
214+ assert received_requests .get (block = True , timeout = QUEUE_TIMEOUT )
215+ assert received_requests .get (block = True , timeout = QUEUE_TIMEOUT )
212216 assert received_requests .empty ()
213217
214218 # Prepare the response message
You can’t perform that action at this time.
0 commit comments