File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
packages/google-cloud-firestore Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ def default(session):
108108 "asyncmock" ,
109109 "pytest" ,
110110 "pytest-cov" ,
111- "pytest-asyncio<0.17.0 " ,
111+ "pytest-asyncio" ,
112112 "-c" ,
113113 constraints_path ,
114114 )
@@ -214,7 +214,7 @@ def system(session):
214214 "mock" ,
215215 "pytest" ,
216216 "google-cloud-testutils" ,
217- "pytest-asyncio<0.17.0 " ,
217+ "pytest-asyncio" ,
218218 "-c" ,
219219 constraints_path ,
220220 )
Original file line number Diff line number Diff line change 1717import itertools
1818import math
1919import pytest
20+ import pytest_asyncio
2021import operator
2122from typing import Callable , Dict , List , Optional
2223
4041 FIRESTORE_EMULATOR ,
4142)
4243
43- _test_event_loop = asyncio .new_event_loop ()
4444pytestmark = pytest .mark .asyncio
4545
4646
@@ -62,7 +62,7 @@ def client():
6262 yield firestore .AsyncClient (project = project , credentials = credentials )
6363
6464
65- @pytest .fixture
65+ @pytest_asyncio .fixture
6666async def cleanup ():
6767 operations = []
6868 yield operations .append
@@ -71,10 +71,13 @@ async def cleanup():
7171 await operation ()
7272
7373
74- @pytest .fixture
74+ @pytest .fixture ( scope = "module" )
7575def event_loop ():
76- asyncio .set_event_loop (_test_event_loop )
77- return asyncio .get_event_loop ()
76+ """Change event_loop fixture to module level."""
77+ policy = asyncio .get_event_loop_policy ()
78+ loop = policy .new_event_loop ()
79+ yield loop
80+ loop .close ()
7881
7982
8083async def test_collections (client ):
@@ -546,7 +549,7 @@ async def test_collection_add(client, cleanup):
546549 assert set ([i async for i in collection3 .list_documents ()]) == {document_ref5 }
547550
548551
549- @pytest .fixture
552+ @pytest_asyncio .fixture
550553async def query_docs (client ):
551554 collection_id = "qs" + UNIQUE_RESOURCE_ID
552555 sub_collection = "child" + UNIQUE_RESOURCE_ID
You can’t perform that action at this time.
0 commit comments