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 36
36
from . import mqtt_packet
37
37
from .conftest import QUEUE_TIMEOUT
38
38
39
+ RELEASE_TIMEOUT = 2
40
+
39
41
40
42
@pytest .fixture (name = "a01_mqtt_client" )
41
43
async def a01_mqtt_client_fixture (
@@ -59,9 +61,11 @@ async def a01_mqtt_client_fixture(
59
61
try :
60
62
yield client
61
63
finally :
62
- if not client .is_connected ():
64
+ # Cleanup is best effort to reduce number of active threads
65
+ if client .is_connected ():
63
66
try :
64
- await client .async_release ()
67
+ async with asyncio .timeout (RELEASE_TIMEOUT ):
68
+ await client .async_release ()
65
69
except Exception :
66
70
pass
67
71
@@ -207,8 +211,8 @@ async def test_set_value(
207
211
"""Test sending an arbitrary MQTT message and parsing the response."""
208
212
# Clear existing messages received during setup
209
213
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 )
212
216
assert received_requests .empty ()
213
217
214
218
# Prepare the response message
You can’t perform that action at this time.
0 commit comments