Skip to content

Commit 58ca6f0

Browse files
committed
PYTHON-5113 - Refactor test utils for async
1 parent 3e29671 commit 58ca6f0

File tree

100 files changed

+1162
-1026
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1162
-1026
lines changed

test/asynchronous/test_async_cancellation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import asyncio
1919
import sys
20-
from test.utils import async_get_pool, delay, one
20+
from test.utils_shared import async_get_pool, delay, one
2121

2222
sys.path[0:0] = [""]
2323

test/asynchronous/test_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
async_client_context,
3131
unittest,
3232
)
33-
from test.utils import AllowListEventListener, delay, ignore_deprecations
33+
from test.utils_shared import AllowListEventListener, delay, ignore_deprecations
3434

3535
import pytest
3636

test/asynchronous/test_bulk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
sys.path[0:0] = [""]
2525

2626
from test.asynchronous import AsyncIntegrationTest, async_client_context, remove_all_users, unittest
27-
from test.utils import async_wait_until
27+
from test.utils_shared import async_wait_until
2828

2929
from bson.binary import Binary, UuidRepresentation
3030
from bson.codec_options import CodecOptions

test/asynchronous/test_change_stream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
unittest,
3737
)
3838
from test.asynchronous.unified_format import generate_test_classes
39-
from test.utils import (
39+
from test.utils_shared import (
4040
AllowListEventListener,
4141
EventListener,
4242
OvertCommandListener,

test/asynchronous/test_client.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@
6060
unittest,
6161
)
6262
from test.asynchronous.pymongo_mocks import AsyncMockClient
63-
from test.test_binary import BinaryData
64-
from test.utils import (
65-
NTHREADS,
66-
CMAPListener,
67-
FunctionCallRecorder,
63+
from test.asynchronous.utils import (
64+
AsyncFunctionCallRecorder,
6865
async_get_pool,
6966
async_wait_until,
7067
asyncAssertRaisesExactly,
68+
)
69+
from test.test_binary import BinaryData
70+
from test.utils_shared import (
71+
NTHREADS,
72+
CMAPListener,
7173
delay,
7274
gevent_monkey_patched,
7375
is_greenthread_patched,
@@ -511,7 +513,7 @@ async def test_connection_timeout_ms_propagates_to_DNS_resolver(self):
511513
# Patch the resolver.
512514
from pymongo.srv_resolver import _resolve
513515

514-
patched_resolver = FunctionCallRecorder(_resolve)
516+
patched_resolver = AsyncFunctionCallRecorder(_resolve)
515517
pymongo.srv_resolver._resolve = patched_resolver
516518

517519
def reset_resolver():

test/asynchronous/test_client_bulk_write.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
async_client_context,
2626
unittest,
2727
)
28-
from test.utils import (
28+
from test.utils_shared import (
2929
OvertCommandListener,
3030
)
3131
from unittest.mock import patch

test/asynchronous/test_collation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import functools
1919
import warnings
2020
from test.asynchronous import AsyncIntegrationTest, async_client_context, unittest
21-
from test.utils import EventListener, OvertCommandListener
21+
from test.utils_shared import EventListener, OvertCommandListener
2222
from typing import Any
2323

2424
from pymongo.asynchronous.helpers import anext

test/asynchronous/test_collection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
AsyncUnitTest,
3434
async_client_context,
3535
)
36-
from test.utils import (
36+
from test.utils_shared import (
3737
IMPOSSIBLE_WRITE_CONCERN,
3838
EventListener,
3939
OvertCommandListener,

test/asynchronous/test_comment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
sys.path[0:0] = [""]
2323
from asyncio import iscoroutinefunction
2424
from test.asynchronous import AsyncIntegrationTest, async_client_context, unittest
25-
from test.utils import OvertCommandListener
25+
from test.utils_shared import OvertCommandListener
2626

2727
from bson.dbref import DBRef
2828
from pymongo.asynchronous.command_cursor import AsyncCommandCursor

test/asynchronous/test_concurrency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import asyncio
1919
import time
2020
from test.asynchronous import AsyncIntegrationTest, async_client_context
21-
from test.utils import delay
21+
from test.utils_shared import delay
2222

2323
_IS_SYNC = False
2424

0 commit comments

Comments
 (0)