Skip to content

Commit

Permalink
Update test to wait for open event
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Jan 21, 2025
1 parent fe04091 commit 44de3ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,9 @@ def test_emit_mq_message(self):
queue=test_queue, callback=callback)
connector.run(run_sync=False, run_observer=False)

open_event = threading.Event()
close_event = threading.Event()
on_open = Mock()
on_open = Mock(side_effect=lambda *args: open_event.set())
on_error = Mock()
on_close = Mock(side_effect=lambda *args: close_event.set())

Expand Down Expand Up @@ -396,6 +397,8 @@ def test_emit_mq_message(self):
callback_event.clear()

# Async connection emit
open_event.wait(timeout=5)
self.assertTrue(open_event.is_set())
on_open.assert_called_once()
message_id_2 = connector.emit_mq_message(async_connection,
request_data, queue=test_queue)
Expand Down

0 comments on commit 44de3ca

Please sign in to comment.