Skip to content

Commit

Permalink
Make api an async fixture to grab reference to loop early
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Oct 26, 2024
1 parent 69224d1 commit b9ccd07
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def gateway():


@pytest.fixture
def api(gateway, mock_command_rsp):
async def api(gateway, mock_command_rsp):
loop = asyncio.get_running_loop()

async def mock_connect(config, api):
transport = MagicMock()
transport.close = MagicMock(
side_effect=lambda: asyncio.get_running_loop().call_soon(
gateway.connection_lost, None
)
side_effect=lambda: loop.call_soon(gateway.connection_lost, None)
)

gateway._api = api
Expand Down

0 comments on commit b9ccd07

Please sign in to comment.