test: fix gateway async test event loop usage

Use asyncio.run in sync tests that were relying on an implicit current event loop. This makes the gateway send-image and Slack connect tests pass reliably under Python 3.11+ and xdist workers.
This commit is contained in:
teknium1 2026-03-14 02:52:47 -07:00
parent 486cb772b8
commit 115dd17b3c
2 changed files with 17 additions and 12 deletions

View file

@ -130,7 +130,7 @@ class TestAppMentionHandler:
patch.object(_slack_mod, "AsyncSocketModeHandler", return_value=MagicMock()), \
patch.dict(os.environ, {"SLACK_APP_TOKEN": "xapp-fake"}), \
patch("asyncio.create_task"):
asyncio.get_event_loop().run_until_complete(adapter.connect())
asyncio.run(adapter.connect())
assert "message" in registered_events
assert "app_mention" in registered_events