Skip to content

Commit 34ca759

Browse files
authored
PYTHON-5113 - Refactor test utils for async (#2149)
1 parent 4322fdf commit 34ca759

File tree

101 files changed

+1184
-1130
lines changed

Some content is hidden

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

101 files changed

+1184
-1130
lines changed

test/asynchronous/test_async_cancellation.py

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

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

2223
sys.path[0:0] = [""]
2324

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: 6 additions & 4 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.asynchronous.utils import (
64+
async_get_pool,
65+
async_wait_until,
66+
asyncAssertRaisesExactly,
67+
)
6368
from test.test_binary import BinaryData
64-
from test.utils import (
69+
from test.utils_shared import (
6570
NTHREADS,
6671
CMAPListener,
6772
FunctionCallRecorder,
68-
async_get_pool,
69-
async_wait_until,
70-
asyncAssertRaisesExactly,
7173
delay,
7274
gevent_monkey_patched,
7375
is_greenthread_patched,

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: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import sys
2222
from codecs import utf_8_decode
2323
from collections import defaultdict
24+
from test.asynchronous.utils import async_get_pool, async_is_mongos
2425
from typing import Any, Iterable, no_type_check
2526

2627
from pymongo.asynchronous.database import AsyncDatabase
@@ -33,12 +34,10 @@
3334
AsyncUnitTest,
3435
async_client_context,
3536
)
36-
from test.utils import (
37+
from test.utils_shared import (
3738
IMPOSSIBLE_WRITE_CONCERN,
3839
EventListener,
3940
OvertCommandListener,
40-
async_get_pool,
41-
async_is_mongos,
4241
async_wait_until,
4342
)
4443

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)