|
4 | 4 | import os |
5 | 5 | import platform |
6 | 6 | import sys |
7 | | -import warnings |
8 | 7 | from datetime import datetime, timedelta |
9 | 8 | from inspect import isawaitable |
10 | 9 | from random import random |
@@ -144,30 +143,18 @@ def _get_async_mongo_test_uri() -> str: |
144 | 143 | pytest.skip("pymongo_inmemory is required for async mongo tests when not using dockerized MongoDB") |
145 | 144 |
|
146 | 145 | if not hasattr(_get_async_mongo_test_uri, "client"): |
147 | | - tar_extract_deprecation_regex = ( |
148 | | - r"Python 3\.14 will, by default, filter extracted tar archives " |
149 | | - r"and reject files or modify their metadata\." |
150 | | - ) |
151 | | - with warnings.catch_warnings(): |
152 | | - warnings.filterwarnings( |
153 | | - "ignore", |
154 | | - message=tar_extract_deprecation_regex, |
155 | | - category=DeprecationWarning, |
156 | | - ) |
157 | | - _get_async_mongo_test_uri.client = InMemoryMongoClient() |
| 146 | + _get_async_mongo_test_uri.client = InMemoryMongoClient() |
158 | 147 |
|
159 | 148 | host, port = _get_async_mongo_test_uri.client.address |
160 | 149 | return f"mongodb://{quote_plus(str(host))}:{quote_plus(str(port))}?retrywrites=true&w=majority" |
161 | 150 |
|
162 | 151 |
|
163 | 152 | def _get_async_mongo_client(): |
164 | 153 | """Build an AsyncMongoClient connected to the async test MongoDB instance.""" |
165 | | - pytest.importorskip( |
| 154 | + async_client_module = pytest.importorskip( |
166 | 155 | "pymongo.asynchronous.mongo_client", reason="pymongo with async support is required for async mongo tests" |
167 | 156 | ) |
168 | | - from pymongo.asynchronous.mongo_client import AsyncMongoClient |
169 | | - |
170 | | - return AsyncMongoClient(_get_async_mongo_test_uri()) |
| 157 | + return async_client_module.AsyncMongoClient(_get_async_mongo_test_uri()) |
171 | 158 |
|
172 | 159 |
|
173 | 160 | async def _maybe_await(value): |
|
0 commit comments