Skip to content
Prev Previous commit
Next Next commit
fix: Correctly scope async eventloop
  • Loading branch information
jonathanedey committed Jun 16, 2025
commit 01af3d2521584577b4744a9e296fd9565470444b
8 changes: 4 additions & 4 deletions integration/test_firestore_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}


@pytest.mark.asyncio
@pytest.mark.asyncio(loop_scope="session")
async def test_firestore_async():
client = firestore_async.client()
expected = _CITY
Expand All @@ -48,7 +48,7 @@ async def test_firestore_async():
data = await doc.get()
assert data.exists is False

@pytest.mark.asyncio
@pytest.mark.asyncio(loop_scope="session")
async def test_firestore_async_explicit_database_id():
client = firestore_async.client(database_id='testing-database')
expected = _CITY
Expand All @@ -62,7 +62,7 @@ async def test_firestore_async_explicit_database_id():
data = await doc.get()
assert data.exists is False

@pytest.mark.asyncio
@pytest.mark.asyncio(loop_scope="session")
async def test_firestore_async_multi_db():
city_client = firestore_async.client()
movie_client = firestore_async.client(database_id='testing-database')
Expand Down Expand Up @@ -98,7 +98,7 @@ async def test_firestore_async_multi_db():
assert data[0].exists is False
assert data[1].exists is False

@pytest.mark.asyncio
@pytest.mark.asyncio(loop_scope="session")
async def test_server_timestamp():
client = firestore_async.client()
expected = {
Expand Down
6 changes: 3 additions & 3 deletions integration/test_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def test_unsubscribe():
resp = messaging.unsubscribe_from_topic(_REGISTRATION_TOKEN, 'mock-topic')
assert resp.success_count + resp.failure_count == 1

@pytest.mark.asyncio
@pytest.mark.asyncio(loop_scope="session")
async def test_send_each_async():
messages = [
messaging.Message(
Expand Down Expand Up @@ -189,7 +189,7 @@ async def test_send_each_async():
assert isinstance(response.exception, exceptions.InvalidArgumentError)
assert response.message_id is None

@pytest.mark.asyncio
@pytest.mark.asyncio(loop_scope="session")
async def test_send_each_async_500():
messages = []
for msg_number in range(500):
Expand All @@ -206,7 +206,7 @@ async def test_send_each_async_500():
assert response.exception is None
assert re.match('^projects/.*/messages/.*$', response.message_id)

@pytest.mark.asyncio
@pytest.mark.asyncio(loop_scope="session")
async def test_send_each_for_multicast_async():
multicast = messaging.MulticastMessage(
notification=messaging.Notification('Title', 'Body'),
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[tool:pytest]
testpaths = tests
asyncio_default_test_loop_scope = session
asyncio_default_test_loop_scope = class
asyncio_default_fixture_loop_scope = None