Skip to content

Commit 01af3d2

Browse files
committed
fix: Correctly scope async eventloop
1 parent c2f2f07 commit 01af3d2

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

integration/test_firestore_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
}
3535

3636

37-
@pytest.mark.asyncio
37+
@pytest.mark.asyncio(loop_scope="session")
3838
async def test_firestore_async():
3939
client = firestore_async.client()
4040
expected = _CITY
@@ -48,7 +48,7 @@ async def test_firestore_async():
4848
data = await doc.get()
4949
assert data.exists is False
5050

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

65-
@pytest.mark.asyncio
65+
@pytest.mark.asyncio(loop_scope="session")
6666
async def test_firestore_async_multi_db():
6767
city_client = firestore_async.client()
6868
movie_client = firestore_async.client(database_id='testing-database')
@@ -98,7 +98,7 @@ async def test_firestore_async_multi_db():
9898
assert data[0].exists is False
9999
assert data[1].exists is False
100100

101-
@pytest.mark.asyncio
101+
@pytest.mark.asyncio(loop_scope="session")
102102
async def test_server_timestamp():
103103
client = firestore_async.client()
104104
expected = {

integration/test_messaging.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def test_unsubscribe():
157157
resp = messaging.unsubscribe_from_topic(_REGISTRATION_TOKEN, 'mock-topic')
158158
assert resp.success_count + resp.failure_count == 1
159159

160-
@pytest.mark.asyncio
160+
@pytest.mark.asyncio(loop_scope="session")
161161
async def test_send_each_async():
162162
messages = [
163163
messaging.Message(
@@ -189,7 +189,7 @@ async def test_send_each_async():
189189
assert isinstance(response.exception, exceptions.InvalidArgumentError)
190190
assert response.message_id is None
191191

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

209-
@pytest.mark.asyncio
209+
@pytest.mark.asyncio(loop_scope="session")
210210
async def test_send_each_for_multicast_async():
211211
multicast = messaging.MulticastMessage(
212212
notification=messaging.Notification('Title', 'Body'),

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[tool:pytest]
22
testpaths = tests
3-
asyncio_default_test_loop_scope = session
3+
asyncio_default_test_loop_scope = class
44
asyncio_default_fixture_loop_scope = None

0 commit comments

Comments
 (0)