From d77c20497b2bec8da8203279fd427f74a91370c9 Mon Sep 17 00:00:00 2001 From: Julius Park Date: Wed, 13 Oct 2021 14:08:04 -0700 Subject: [PATCH] PYTHON-2940 Fix spec tests that require DNSPython (#756) --- test/test_uri_spec.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_uri_spec.py b/test/test_uri_spec.py index cfca63345..2646f02e4 100644 --- a/test/test_uri_spec.py +++ b/test/test_uri_spec.py @@ -24,7 +24,8 @@ sys.path[0:0] = [""] from pymongo.common import INTERNAL_URI_OPTION_NAME_MAP, validate from pymongo.compression_support import _HAVE_SNAPPY -from pymongo.uri_parser import parse_uri +from pymongo.srv_resolver import _HAVE_DNSPYTHON +from pymongo.uri_parser import parse_uri, SRV_SCHEME from test import clear_warning_registry, unittest @@ -92,7 +93,8 @@ def create_test(test, test_workdir): compressors = (test.get('options') or {}).get('compressors', []) if 'snappy' in compressors and not _HAVE_SNAPPY: self.skipTest('This test needs the snappy module.') - + if test['uri'].startswith(SRV_SCHEME) and not _HAVE_DNSPYTHON: + self.skipTest("This test needs dnspython package.") valid = True warning = False