Skip to content

Commit 9e22214

Browse files
committed
fix test
1 parent 5ed3ed4 commit 9e22214

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pymongo/common.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@
139139
# Default value for serverMonitoringMode
140140
SERVER_MONITORING_MODE = "auto" # poll/stream/auto
141141

142-
# Options that must raise an error instead of warning if they invalidate.
143-
_OPTION_MUST_RAISE = ["CANONICALIZE_HOST_NAME"]
142+
# Auth mechanism properties that must raise an error instead of warning if they invalidate.
143+
_MECH_PROP_MUST_RAISE = ["CANONICALIZE_HOST_NAME"]
144144

145145

146146
def partition_node(node: str) -> tuple[str, int]:
@@ -873,7 +873,9 @@ def get_setter_key(x: str) -> str:
873873
validator = _get_validator(opt, URI_OPTIONS_VALIDATOR_MAP, normed_key=normed_key)
874874
validated = validator(opt, value)
875875
except (ValueError, TypeError, ConfigurationError) as exc:
876-
if warn and opt not in _OPTION_MUST_RAISE:
876+
if normed_key == "authmechanismproperties" and _MECH_PROP_MUST_RAISE in str(exc):
877+
raise
878+
if warn:
877879
warnings.warn(str(exc), stacklevel=2)
878880
else:
879881
raise

0 commit comments

Comments
 (0)