Skip to content

Commit 278a7d7

Browse files
committed
fix: Use simple pytest.skip for compatibility checks
1 parent 895f52a commit 278a7d7

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

tests/mongo_tests/test_async_mongo_core.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import os
55
import platform
66
import sys
7-
import warnings
87
from datetime import datetime, timedelta
98
from inspect import isawaitable
109
from random import random
@@ -144,30 +143,18 @@ def _get_async_mongo_test_uri() -> str:
144143
pytest.skip("pymongo_inmemory is required for async mongo tests when not using dockerized MongoDB")
145144

146145
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()
158147

159148
host, port = _get_async_mongo_test_uri.client.address
160149
return f"mongodb://{quote_plus(str(host))}:{quote_plus(str(port))}?retrywrites=true&w=majority"
161150

162151

163152
def _get_async_mongo_client():
164153
"""Build an AsyncMongoClient connected to the async test MongoDB instance."""
165-
pytest.importorskip(
154+
async_client_module = pytest.importorskip(
166155
"pymongo.asynchronous.mongo_client", reason="pymongo with async support is required for async mongo tests"
167156
)
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())
171158

172159

173160
async def _maybe_await(value):

0 commit comments

Comments
 (0)