Skip to content

Commit b6baf79

Browse files
committed
TestAsyncClientUnitTest done
1 parent 266b0a3 commit b6baf79

File tree

2 files changed

+546
-545
lines changed

2 files changed

+546
-545
lines changed

test/asynchronous/conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import asyncio
44
import sys
55

6+
import pymongo
67
from typing_extensions import Any
78

89
from pymongo import AsyncMongoClient
@@ -14,6 +15,8 @@
1415
import pytest
1516
import pytest_asyncio
1617

18+
from test.utils import FunctionCallRecorder
19+
1720
_IS_SYNC = False
1821

1922

@@ -124,6 +127,15 @@ def simple_client(h: Any = None, p: Any = None, **kwargs: Any) -> AsyncMongoClie
124127
client = AsyncMongoClient(h, p, **kwargs)
125128
return client
126129

130+
@pytest.fixture(scope="function")
131+
def patch_resolver():
132+
from pymongo.srv_resolver import _resolve
133+
134+
patched_resolver = FunctionCallRecorder(_resolve)
135+
pymongo.srv_resolver._resolve = patched_resolver
136+
yield patched_resolver
137+
pymongo.srv_resolver._resolve = _resolve
138+
127139

128140

129141
pytest_collection_modifyitems = pytest_conf.pytest_collection_modifyitems

0 commit comments

Comments
 (0)