diff --git a/.evergreen/run-mongodb-oidc-test.sh b/.evergreen/run-mongodb-oidc-test.sh index e84df2539..8ab560531 100755 --- a/.evergreen/run-mongodb-oidc-test.sh +++ b/.evergreen/run-mongodb-oidc-test.sh @@ -51,7 +51,6 @@ if [ -z "$PYTHON_BINARY" ]; then fi export TEST_AUTH_OIDC=1 -export AUTH_MECH="SCRAM-SHA-256" export AUTH="auth" export SET_XTRACE_ON=1 bash ./.evergreen/tox.sh -m test-eg diff --git a/pymongo/helpers.py b/pymongo/helpers.py index 0fcd84b44..afab67e4e 100644 --- a/pymongo/helpers.py +++ b/pymongo/helpers.py @@ -308,6 +308,7 @@ F = TypeVar("F", bound=Callable[..., Any]) def _handle_reauth(func: F) -> F: def inner(*args: Any, **kwargs: Any) -> Any: no_reauth = kwargs.pop("no_reauth", False) + from pymongo.message import _BulkWriteContext from pymongo.pool import Connection try: @@ -324,7 +325,7 @@ def _handle_reauth(func: F) -> F: if isinstance(arg, Connection): conn = arg break - if hasattr(arg, "connection"): + if isinstance(arg, _BulkWriteContext): conn = arg.conn break if conn: diff --git a/test/__init__.py b/test/__init__.py index d025d7e08..846d4a279 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -95,7 +95,6 @@ TEST_LOADBALANCER = bool(os.environ.get("TEST_LOADBALANCER")) TEST_SERVERLESS = bool(os.environ.get("TEST_SERVERLESS")) SINGLE_MONGOS_LB_URI = os.environ.get("SINGLE_MONGOS_LB_URI") MULTI_MONGOS_LB_URI = os.environ.get("MULTI_MONGOS_LB_URI") -AUTH_MECH = os.environ.get("AUTH_MECH") if TEST_LOADBALANCER: res = parse_uri(SINGLE_MONGOS_LB_URI or "") @@ -278,8 +277,6 @@ class ClientContext: self.is_data_lake = False self.load_balancer = TEST_LOADBALANCER self.serverless = TEST_SERVERLESS - if AUTH_MECH: - self.default_client_options["authMechanism"] = AUTH_MECH if self.load_balancer or self.serverless: self.default_client_options["loadBalanced"] = True if COMPRESSORS: @@ -347,7 +344,6 @@ class ClientContext: def _init_client(self): self.client = self._connect(host, port) - if self.client is not None: # Return early when connected to dataLake as mongohoused does not # support the getCmdLineOpts command and is tested without TLS.