diff --git a/.evergreen/generated_configs/tasks.yml b/.evergreen/generated_configs/tasks.yml index e3f5492ac9..6e75170ec9 100644 --- a/.evergreen/generated_configs/tasks.yml +++ b/.evergreen/generated_configs/tasks.yml @@ -242,6 +242,98 @@ tasks: TEST_MIN_DEPS: "1" tags: [test-min-deps, sharded_cluster-auth-ssl] + # Min support tests + - name: test-min-support-python3.9-standalone-noauth-nossl + commands: + - func: run server + - func: run tests + vars: + UV_PYTHON: "3.9" + AUTH: noauth + SSL: nossl + TOPOLOGY: standalone + tags: [test-min-support] + - name: test-min-support-python3.9-replica-set-noauth-ssl + commands: + - func: run server + - func: run tests + vars: + UV_PYTHON: "3.9" + AUTH: noauth + SSL: ssl + TOPOLOGY: replica_set + tags: [test-min-support] + - name: test-min-support-python3.9-sharded-cluster-auth-ssl + commands: + - func: run server + - func: run tests + vars: + UV_PYTHON: "3.9" + AUTH: auth + SSL: ssl + TOPOLOGY: sharded_cluster + tags: [test-min-support] + - name: test-min-support-pypy3.9-standalone-noauth-nossl + commands: + - func: run server + - func: run tests + vars: + UV_PYTHON: pypy3.9 + AUTH: noauth + SSL: nossl + TOPOLOGY: standalone + tags: [test-min-support] + - name: test-min-support-pypy3.9-replica-set-noauth-ssl + commands: + - func: run server + - func: run tests + vars: + UV_PYTHON: pypy3.9 + AUTH: noauth + SSL: ssl + TOPOLOGY: replica_set + tags: [test-min-support] + - name: test-min-support-pypy3.9-sharded-cluster-auth-ssl + commands: + - func: run server + - func: run tests + vars: + UV_PYTHON: pypy3.9 + AUTH: auth + SSL: ssl + TOPOLOGY: sharded_cluster + tags: [test-min-support] + - name: test-min-support-pypy3.10-standalone-noauth-nossl + commands: + - func: run server + - func: run tests + vars: + UV_PYTHON: pypy3.10 + AUTH: noauth + SSL: nossl + TOPOLOGY: standalone + tags: [test-min-support] + - name: test-min-support-pypy3.10-replica-set-noauth-ssl + commands: + - func: run server + - func: run tests + vars: + UV_PYTHON: pypy3.10 + AUTH: noauth + SSL: ssl + TOPOLOGY: replica_set + tags: [test-min-support] + - name: test-min-support-pypy3.10-sharded-cluster-auth-ssl + commands: + - func: run server + - func: run tests + vars: + UV_PYTHON: pypy3.10 + AUTH: auth + SSL: ssl + TOPOLOGY: sharded_cluster + tags: [test-min-support] + # Mod wsgi tests - name: mod-wsgi-replica-set-python3.10 commands: diff --git a/.evergreen/generated_configs/variants.yml b/.evergreen/generated_configs/variants.yml index 8261f08236..a0f2025bbd 100644 --- a/.evergreen/generated_configs/variants.yml +++ b/.evergreen/generated_configs/variants.yml @@ -326,6 +326,14 @@ buildvariants: expansions: TEST_NAME: load_balancer + # Min support tests + - name: min-support-rhel8 + tasks: + - name: .test-min-support + display_name: Min Support RHEL8 + run_on: + - rhel87-small + # Mockupdb tests - name: mockupdb-rhel8 tasks: diff --git a/.evergreen/scripts/generate_config.py b/.evergreen/scripts/generate_config.py index 5937d72964..2d9c478d79 100644 --- a/.evergreen/scripts/generate_config.py +++ b/.evergreen/scripts/generate_config.py @@ -502,6 +502,12 @@ def create_aws_auth_variants(): return variants +def create_min_support_variants(): + host = HOSTS["rhel8"] + name = get_variant_name("Min Support", host=host) + return [create_variant([".test-min-support"], name, host=host)] + + def create_no_server_variants(): host = HOSTS["rhel8"] name = get_variant_name("No server", host=host) @@ -897,6 +903,24 @@ def _create_ocsp_tasks(algo, variant, server_type, base_task_name): return tasks +def create_min_support_tasks(): + server_func = FunctionCall(func="run server") + from generate_config_utils import MIN_SUPPORT_VERSIONS + + tasks = [] + for python, topology in product(MIN_SUPPORT_VERSIONS, TOPOLOGIES): + auth, ssl = get_standard_auth_ssl(topology) + vars = dict(UV_PYTHON=python, AUTH=auth, SSL=ssl, TOPOLOGY=topology) + test_func = FunctionCall(func="run tests", vars=vars) + task_name = get_task_name( + "test-min-support", python=python, topology=topology, auth=auth, ssl=ssl + ) + tags = ["test-min-support"] + commands = [server_func, test_func] + tasks.append(EvgTask(name=task_name, tags=tags, commands=commands)) + return tasks + + def create_aws_lambda_tasks(): assume_func = FunctionCall(func="assume ec2 role") vars = dict(TEST_NAME="aws_lambda") diff --git a/.evergreen/scripts/generate_config_utils.py b/.evergreen/scripts/generate_config_utils.py index a32092f5b2..cc56664adb 100644 --- a/.evergreen/scripts/generate_config_utils.py +++ b/.evergreen/scripts/generate_config_utils.py @@ -24,6 +24,7 @@ ALL_VERSIONS = ["4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "rapid", "latest"] CPYTHONS = ["3.10", "3.11", "3.12", "3.13", "3.14t", "3.14"] PYPYS = ["pypy3.11"] +MIN_SUPPORT_VERSIONS = ["3.9", "pypy3.9", "pypy3.10"] ALL_PYTHONS = CPYTHONS + PYPYS MIN_MAX_PYTHON = [CPYTHONS[0], CPYTHONS[-1]] BATCHTIME_WEEK = 10080 diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 81c6fa4200..27e988c41c 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -83,6 +83,7 @@ jobs: - name: Assert all versions in wheelhouse if: ${{ ! startsWith(matrix.buildplat[1], 'macos') }} run: | + ls wheelhouse/*cp39*.whl ls wheelhouse/*cp310*.whl ls wheelhouse/*cp311*.whl ls wheelhouse/*cp312*.whl @@ -110,7 +111,7 @@ jobs: - uses: actions/setup-python@v6 with: # Build sdist on lowest supported Python - python-version: "3.10" + python-version: "3.9" - name: Build SDist run: | diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 682a8d98d0..c898c13259 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -208,7 +208,7 @@ jobs: cache: 'pip' cache-dependency-path: 'pyproject.toml' # Build sdist on lowest supported Python - python-version: "3.10" + python-version: "3.9" - name: Build SDist shell: bash run: | @@ -242,7 +242,7 @@ jobs: cache: 'pip' cache-dependency-path: 'sdist/test/pyproject.toml' # Test sdist on lowest supported Python - python-version: "3.10" + python-version: "3.9" - id: setup-mongodb uses: mongodb-labs/drivers-evergreen-tools@master - name: Run connect test from sdist @@ -266,7 +266,7 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7 with: - python-version: "3.10" + python-version: "3.9" - id: setup-mongodb uses: mongodb-labs/drivers-evergreen-tools@master with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e35063af6..46b629c563 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,7 @@ be of interest or that has already been addressed. ## Supported Interpreters -PyMongo supports CPython 3.10+ and PyPy3.10+. Language features not +PyMongo supports CPython 3.9+ and PyPy3.9+. Language features not supported by all interpreters can not be used. ## Style Guide diff --git a/README.md b/README.md index b8bfa294a6..c807733e5b 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ package that is incompatible with PyMongo. ## Dependencies -PyMongo supports CPython 3.10+ and PyPy3.10+. +PyMongo supports CPython 3.9+ and PyPy3.9+. Required dependencies: diff --git a/doc/changelog.rst b/doc/changelog.rst index e205f2cc12..a2a8f6c211 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -6,14 +6,11 @@ Changes in Version 4.16.0 (XXXX/XX/XX) PyMongo 4.16 brings a number of changes including: -.. warning:: PyMongo 4.16 drops support for Python 3.9 and PyPy 3.10: Python 3.10+ or PyPy 3.11+ is now required. - -- Dropped support for Python 3.9 and PyPy 3.10. - Removed invalid documents from :class:`bson.errors.InvalidDocument` error messages as doing so may leak sensitive user data. Instead, invalid documents are stored in :attr:`bson.errors.InvalidDocument.document`. -- PyMongo now requires ``dnspython>=2.6.1``, since ``dnspython`` 1.0 is no longer maintained and is incompatible with - Python 3.10+. The minimum version is ``2.6.1`` to account for `CVE-2023-29483 `_. +- PyMongo now requires ``dnspython>=2.6.1``, since ``dnspython`` 1.0 is no longer maintained. + The minimum version is ``2.6.1`` to account for `CVE-2023-29483 `_. - Removed support for Eventlet. Eventlet is actively being sunset by its maintainers and has compatibility issues with PyMongo's dnspython dependency. - Use Zstandard support from the standard library for Python 3.14+, and use ``backports.zstd`` for older versions. diff --git a/gridfs/asynchronous/grid_file.py b/gridfs/asynchronous/grid_file.py index 69a2200d3b..e512f796a8 100644 --- a/gridfs/asynchronous/grid_file.py +++ b/gridfs/asynchronous/grid_file.py @@ -46,6 +46,7 @@ from pymongo.asynchronous.collection import AsyncCollection from pymongo.asynchronous.cursor import AsyncCursor from pymongo.asynchronous.database import AsyncDatabase +from pymongo.asynchronous.helpers import anext from pymongo.common import validate_string from pymongo.errors import ( BulkWriteError, diff --git a/gridfs/synchronous/grid_file.py b/gridfs/synchronous/grid_file.py index 7364aedda3..70a4f80774 100644 --- a/gridfs/synchronous/grid_file.py +++ b/gridfs/synchronous/grid_file.py @@ -57,6 +57,7 @@ from pymongo.synchronous.collection import Collection from pymongo.synchronous.cursor import Cursor from pymongo.synchronous.database import Database +from pymongo.synchronous.helpers import next _IS_SYNC = True diff --git a/pymongo/asynchronous/cursor.py b/pymongo/asynchronous/cursor.py index f19d3f6cee..67494192fe 100644 --- a/pymongo/asynchronous/cursor.py +++ b/pymongo/asynchronous/cursor.py @@ -37,6 +37,7 @@ from bson.code import Code from bson.son import SON from pymongo import _csot, helpers_shared +from pymongo.asynchronous.helpers import anext from pymongo.collation import validate_collation_or_none from pymongo.common import ( validate_is_document_type, diff --git a/pymongo/asynchronous/helpers.py b/pymongo/asynchronous/helpers.py index 4a8c918133..ccda16e28b 100644 --- a/pymongo/asynchronous/helpers.py +++ b/pymongo/asynchronous/helpers.py @@ -16,7 +16,9 @@ from __future__ import annotations import asyncio +import builtins import socket +import sys from typing import ( Any, Callable, @@ -84,3 +86,17 @@ async def _getaddrinfo( return await loop.getaddrinfo(host, port, **kwargs) # type: ignore[return-value] else: return socket.getaddrinfo(host, port, **kwargs) + + +if sys.version_info >= (3, 10): + anext = builtins.anext + aiter = builtins.aiter +else: + + async def anext(cls: Any) -> Any: + """Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#anext.""" + return await cls.__anext__() + + def aiter(cls: Any) -> Any: + """Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#anext.""" + return cls.__aiter__() diff --git a/pymongo/synchronous/cursor.py b/pymongo/synchronous/cursor.py index fcd8ebeb1d..d1e9731d99 100644 --- a/pymongo/synchronous/cursor.py +++ b/pymongo/synchronous/cursor.py @@ -55,6 +55,7 @@ _RawBatchQuery, ) from pymongo.response import PinnedResponse +from pymongo.synchronous.helpers import next from pymongo.typings import _Address, _CollationIn, _DocumentOut, _DocumentType from pymongo.write_concern import validate_boolean diff --git a/pymongo/synchronous/helpers.py b/pymongo/synchronous/helpers.py index c1b75a3c95..1fff9a0f23 100644 --- a/pymongo/synchronous/helpers.py +++ b/pymongo/synchronous/helpers.py @@ -16,7 +16,9 @@ from __future__ import annotations import asyncio +import builtins import socket +import sys from typing import ( Any, Callable, @@ -84,3 +86,17 @@ def _getaddrinfo( return loop.getaddrinfo(host, port, **kwargs) # type: ignore[return-value] else: return socket.getaddrinfo(host, port, **kwargs) + + +if sys.version_info >= (3, 10): + next = builtins.next + iter = builtins.iter +else: + + def next(cls: Any) -> Any: + """Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#next.""" + return cls.__next__() + + def iter(cls: Any) -> Any: + """Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#next.""" + return cls.__iter__() diff --git a/test/asynchronous/test_change_stream.py b/test/asynchronous/test_change_stream.py index 3fb8b517f3..1be45bee3e 100644 --- a/test/asynchronous/test_change_stream.py +++ b/test/asynchronous/test_change_stream.py @@ -48,6 +48,7 @@ from bson.raw_bson import DEFAULT_RAW_BSON_OPTIONS, RawBSONDocument from pymongo import AsyncMongoClient from pymongo.asynchronous.command_cursor import AsyncCommandCursor +from pymongo.asynchronous.helpers import anext from pymongo.errors import ( InvalidOperation, OperationFailure, diff --git a/test/asynchronous/test_client.py b/test/asynchronous/test_client.py index 6794605339..f375874916 100644 --- a/test/asynchronous/test_client.py +++ b/test/asynchronous/test_client.py @@ -92,6 +92,7 @@ from pymongo.asynchronous.command_cursor import AsyncCommandCursor from pymongo.asynchronous.cursor import AsyncCursor, CursorType from pymongo.asynchronous.database import AsyncDatabase +from pymongo.asynchronous.helpers import anext from pymongo.asynchronous.mongo_client import AsyncMongoClient from pymongo.asynchronous.pool import ( AsyncConnection, diff --git a/test/asynchronous/test_collation.py b/test/asynchronous/test_collation.py index da810a2a9f..05e548c79e 100644 --- a/test/asynchronous/test_collation.py +++ b/test/asynchronous/test_collation.py @@ -21,6 +21,7 @@ from test.utils_shared import EventListener, OvertCommandListener from typing import Any +from pymongo.asynchronous.helpers import anext from pymongo.collation import ( Collation, CollationAlternate, diff --git a/test/asynchronous/test_collection.py b/test/asynchronous/test_collection.py index 498563fe83..3232650487 100644 --- a/test/asynchronous/test_collection.py +++ b/test/asynchronous/test_collection.py @@ -25,6 +25,7 @@ from typing import Any, Iterable, no_type_check from pymongo.asynchronous.database import AsyncDatabase +from pymongo.asynchronous.helpers import anext sys.path[0:0] = [""] diff --git a/test/asynchronous/test_cursor.py b/test/asynchronous/test_cursor.py index 906f78cc97..08da82762c 100644 --- a/test/asynchronous/test_cursor.py +++ b/test/asynchronous/test_cursor.py @@ -46,6 +46,7 @@ from bson.raw_bson import RawBSONDocument from pymongo import ASCENDING, DESCENDING from pymongo.asynchronous.cursor import AsyncCursor, CursorType +from pymongo.asynchronous.helpers import anext from pymongo.collation import Collation from pymongo.errors import ExecutionTimeout, InvalidOperation, OperationFailure, PyMongoError from pymongo.operations import _IndexList diff --git a/test/asynchronous/test_custom_types.py b/test/asynchronous/test_custom_types.py index f8fa51ba76..82c54512cc 100644 --- a/test/asynchronous/test_custom_types.py +++ b/test/asynchronous/test_custom_types.py @@ -53,6 +53,7 @@ from bson.int64 import Int64 from bson.raw_bson import RawBSONDocument from pymongo.asynchronous.collection import ReturnDocument +from pymongo.asynchronous.helpers import anext from pymongo.errors import DuplicateKeyError from pymongo.message import _CursorAddress diff --git a/test/asynchronous/test_database.py b/test/asynchronous/test_database.py index b49183a852..3b77330c0e 100644 --- a/test/asynchronous/test_database.py +++ b/test/asynchronous/test_database.py @@ -42,6 +42,7 @@ from pymongo.asynchronous import auth from pymongo.asynchronous.collection import AsyncCollection from pymongo.asynchronous.database import AsyncDatabase +from pymongo.asynchronous.helpers import anext from pymongo.asynchronous.mongo_client import AsyncMongoClient from pymongo.errors import ( CollectionInvalid, diff --git a/test/asynchronous/test_encryption.py b/test/asynchronous/test_encryption.py index 74c0136ad0..5331f0a0ef 100644 --- a/test/asynchronous/test_encryption.py +++ b/test/asynchronous/test_encryption.py @@ -86,6 +86,7 @@ from pymongo import ReadPreference from pymongo.asynchronous import encryption from pymongo.asynchronous.encryption import Algorithm, AsyncClientEncryption, QueryType +from pymongo.asynchronous.helpers import anext from pymongo.asynchronous.mongo_client import AsyncMongoClient from pymongo.cursor_shared import CursorType from pymongo.encryption_options import _HAVE_PYMONGOCRYPT, AutoEncryptionOpts, RangeOpts, TextOpts diff --git a/test/asynchronous/test_examples.py b/test/asynchronous/test_examples.py index 21770f490c..dd27623654 100644 --- a/test/asynchronous/test_examples.py +++ b/test/asynchronous/test_examples.py @@ -29,6 +29,7 @@ from test.utils_shared import async_wait_until import pymongo +from pymongo.asynchronous.helpers import anext from pymongo.errors import ConnectionFailure, OperationFailure from pymongo.read_concern import ReadConcern from pymongo.read_preferences import ReadPreference diff --git a/test/asynchronous/test_grid_file.py b/test/asynchronous/test_grid_file.py index 2a7e9e1f9d..f3ca596142 100644 --- a/test/asynchronous/test_grid_file.py +++ b/test/asynchronous/test_grid_file.py @@ -47,6 +47,7 @@ ) from gridfs.errors import NoFile from pymongo import AsyncMongoClient +from pymongo.asynchronous.helpers import aiter, anext from pymongo.errors import ConfigurationError, ServerSelectionTimeoutError from pymongo.message import _CursorAddress diff --git a/test/asynchronous/test_load_balancer.py b/test/asynchronous/test_load_balancer.py index 17d85841f9..db7ff9183f 100644 --- a/test/asynchronous/test_load_balancer.py +++ b/test/asynchronous/test_load_balancer.py @@ -36,6 +36,8 @@ create_async_event, ) +from pymongo.asynchronous.helpers import anext + _IS_SYNC = False pytestmark = pytest.mark.load_balancer diff --git a/test/asynchronous/test_monitoring.py b/test/asynchronous/test_monitoring.py index 6a9a5b8da7..9b2a3691eb 100644 --- a/test/asynchronous/test_monitoring.py +++ b/test/asynchronous/test_monitoring.py @@ -40,6 +40,7 @@ from bson.son import SON from pymongo import CursorType, DeleteOne, InsertOne, UpdateOne, monitoring from pymongo.asynchronous.command_cursor import AsyncCommandCursor +from pymongo.asynchronous.helpers import anext from pymongo.errors import AutoReconnect, NotPrimaryError, OperationFailure from pymongo.read_preferences import ReadPreference from pymongo.write_concern import WriteConcern diff --git a/test/asynchronous/test_read_preferences.py b/test/asynchronous/test_read_preferences.py index d18887da40..72dd809db0 100644 --- a/test/asynchronous/test_read_preferences.py +++ b/test/asynchronous/test_read_preferences.py @@ -42,6 +42,7 @@ from test.version import Version from bson.son import SON +from pymongo.asynchronous.helpers import anext from pymongo.asynchronous.mongo_client import AsyncMongoClient from pymongo.errors import ConfigurationError, OperationFailure from pymongo.message import _maybe_add_read_preference diff --git a/test/asynchronous/test_session.py b/test/asynchronous/test_session.py index ff0feebafc..19ce868c56 100644 --- a/test/asynchronous/test_session.py +++ b/test/asynchronous/test_session.py @@ -48,6 +48,7 @@ from pymongo import ASCENDING, AsyncMongoClient, _csot, monitoring from pymongo.asynchronous.command_cursor import AsyncCommandCursor from pymongo.asynchronous.cursor import AsyncCursor +from pymongo.asynchronous.helpers import anext from pymongo.common import _MAX_END_SESSIONS from pymongo.errors import ConfigurationError, InvalidOperation, OperationFailure from pymongo.operations import IndexModel, InsertOne, UpdateOne diff --git a/test/asynchronous/test_transactions.py b/test/asynchronous/test_transactions.py index 29c5d26423..6849da9896 100644 --- a/test/asynchronous/test_transactions.py +++ b/test/asynchronous/test_transactions.py @@ -40,6 +40,7 @@ from pymongo.asynchronous.client_session import TransactionOptions from pymongo.asynchronous.command_cursor import AsyncCommandCursor from pymongo.asynchronous.cursor import AsyncCursor +from pymongo.asynchronous.helpers import anext from pymongo.errors import ( AutoReconnect, CollectionInvalid, diff --git a/test/asynchronous/unified_format.py b/test/asynchronous/unified_format.py index 0c9e8c10c8..64659a34d4 100644 --- a/test/asynchronous/unified_format.py +++ b/test/asynchronous/unified_format.py @@ -77,6 +77,7 @@ from pymongo.asynchronous.command_cursor import AsyncCommandCursor from pymongo.asynchronous.database import AsyncDatabase from pymongo.asynchronous.encryption import AsyncClientEncryption +from pymongo.asynchronous.helpers import anext from pymongo.driver_info import DriverInfo from pymongo.encryption_options import _HAVE_PYMONGOCRYPT, AutoEncryptionOpts from pymongo.errors import ( diff --git a/test/test_change_stream.py b/test/test_change_stream.py index ad51f91873..59cad8925b 100644 --- a/test/test_change_stream.py +++ b/test/test_change_stream.py @@ -55,6 +55,7 @@ from pymongo.message import _CursorAddress from pymongo.read_concern import ReadConcern from pymongo.synchronous.command_cursor import CommandCursor +from pymongo.synchronous.helpers import next from pymongo.write_concern import WriteConcern _IS_SYNC = True diff --git a/test/test_client.py b/test/test_client.py index 9d201c663b..73ed3ac3d4 100644 --- a/test/test_client.py +++ b/test/test_client.py @@ -114,6 +114,7 @@ from pymongo.synchronous.command_cursor import CommandCursor from pymongo.synchronous.cursor import Cursor, CursorType from pymongo.synchronous.database import Database +from pymongo.synchronous.helpers import next from pymongo.synchronous.mongo_client import MongoClient from pymongo.synchronous.pool import ( Connection, diff --git a/test/test_collation.py b/test/test_collation.py index 903f24a228..5425551dc6 100644 --- a/test/test_collation.py +++ b/test/test_collation.py @@ -37,6 +37,7 @@ UpdateMany, UpdateOne, ) +from pymongo.synchronous.helpers import next from pymongo.write_concern import WriteConcern _IS_SYNC = True diff --git a/test/test_collection.py b/test/test_collection.py index 18be309f22..ac469782e9 100644 --- a/test/test_collection.py +++ b/test/test_collection.py @@ -25,6 +25,7 @@ from typing import Any, Iterable, no_type_check from pymongo.synchronous.database import Database +from pymongo.synchronous.helpers import next sys.path[0:0] = [""] diff --git a/test/test_cursor.py b/test/test_cursor.py index 219ca396c9..b63638bfab 100644 --- a/test/test_cursor.py +++ b/test/test_cursor.py @@ -51,6 +51,7 @@ from pymongo.read_concern import ReadConcern from pymongo.read_preferences import ReadPreference from pymongo.synchronous.cursor import Cursor, CursorType +from pymongo.synchronous.helpers import next from pymongo.write_concern import WriteConcern _IS_SYNC = True diff --git a/test/test_custom_types.py b/test/test_custom_types.py index 02f3127165..aba6b55119 100644 --- a/test/test_custom_types.py +++ b/test/test_custom_types.py @@ -55,6 +55,7 @@ from pymongo.errors import DuplicateKeyError from pymongo.message import _CursorAddress from pymongo.synchronous.collection import ReturnDocument +from pymongo.synchronous.helpers import next _IS_SYNC = True diff --git a/test/test_database.py b/test/test_database.py index ebbf6e55c6..c50e09b6e1 100644 --- a/test/test_database.py +++ b/test/test_database.py @@ -51,6 +51,7 @@ from pymongo.synchronous import auth from pymongo.synchronous.collection import Collection from pymongo.synchronous.database import Database +from pymongo.synchronous.helpers import next from pymongo.synchronous.mongo_client import MongoClient from pymongo.write_concern import WriteConcern diff --git a/test/test_encryption.py b/test/test_encryption.py index 04e61b7bad..d4933bc2d2 100644 --- a/test/test_encryption.py +++ b/test/test_encryption.py @@ -102,6 +102,7 @@ from pymongo.operations import InsertOne, ReplaceOne, UpdateOne from pymongo.synchronous import encryption from pymongo.synchronous.encryption import Algorithm, ClientEncryption, QueryType +from pymongo.synchronous.helpers import next from pymongo.synchronous.mongo_client import MongoClient from pymongo.write_concern import WriteConcern diff --git a/test/test_examples.py b/test/test_examples.py index 266e32e8d4..13f0c94c56 100644 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -33,6 +33,7 @@ from pymongo.read_concern import ReadConcern from pymongo.read_preferences import ReadPreference from pymongo.server_api import ServerApi +from pymongo.synchronous.helpers import next from pymongo.write_concern import WriteConcern _IS_SYNC = True diff --git a/test/test_grid_file.py b/test/test_grid_file.py index c7ccda44a4..6fe209f438 100644 --- a/test/test_grid_file.py +++ b/test/test_grid_file.py @@ -49,6 +49,7 @@ from pymongo import MongoClient from pymongo.errors import ConfigurationError, ServerSelectionTimeoutError from pymongo.message import _CursorAddress +from pymongo.synchronous.helpers import iter, next _IS_SYNC = True diff --git a/test/test_load_balancer.py b/test/test_load_balancer.py index 472ef51da3..364a323627 100644 --- a/test/test_load_balancer.py +++ b/test/test_load_balancer.py @@ -36,6 +36,8 @@ wait_until, ) +from pymongo.synchronous.helpers import next + _IS_SYNC = True pytestmark = pytest.mark.load_balancer diff --git a/test/test_monitoring.py b/test/test_monitoring.py index f5a18af9ed..7cb93adf81 100644 --- a/test/test_monitoring.py +++ b/test/test_monitoring.py @@ -42,6 +42,7 @@ from pymongo.errors import AutoReconnect, NotPrimaryError, OperationFailure from pymongo.read_preferences import ReadPreference from pymongo.synchronous.command_cursor import CommandCursor +from pymongo.synchronous.helpers import next from pymongo.write_concern import WriteConcern _IS_SYNC = True diff --git a/test/test_read_preferences.py b/test/test_read_preferences.py index 084abdf3e1..afde01723d 100644 --- a/test/test_read_preferences.py +++ b/test/test_read_preferences.py @@ -56,6 +56,7 @@ from pymongo.server_description import ServerDescription from pymongo.server_selectors import Selection, readable_server_selector from pymongo.server_type import SERVER_TYPE +from pymongo.synchronous.helpers import next from pymongo.synchronous.mongo_client import MongoClient from pymongo.write_concern import WriteConcern diff --git a/test/test_session.py b/test/test_session.py index 9aa56a711e..40d0a53afb 100644 --- a/test/test_session.py +++ b/test/test_session.py @@ -52,6 +52,7 @@ from pymongo.read_concern import ReadConcern from pymongo.synchronous.command_cursor import CommandCursor from pymongo.synchronous.cursor import Cursor +from pymongo.synchronous.helpers import next _IS_SYNC = True diff --git a/test/test_transactions.py b/test/test_transactions.py index 37e1a249e0..0c5bd42d7d 100644 --- a/test/test_transactions.py +++ b/test/test_transactions.py @@ -51,6 +51,7 @@ from pymongo.synchronous.client_session import TransactionOptions from pymongo.synchronous.command_cursor import CommandCursor from pymongo.synchronous.cursor import Cursor +from pymongo.synchronous.helpers import next _IS_SYNC = True diff --git a/test/unified_format.py b/test/unified_format.py index 0c5f68edd3..580aed552b 100644 --- a/test/unified_format.py +++ b/test/unified_format.py @@ -101,6 +101,7 @@ from pymongo.synchronous.command_cursor import CommandCursor from pymongo.synchronous.database import Database from pymongo.synchronous.encryption import ClientEncryption +from pymongo.synchronous.helpers import next from pymongo.topology_description import TopologyDescription from pymongo.typings import _Address from pymongo.write_concern import WriteConcern