Skip to content

Commit f700158

Browse files
committed
PYTHON-3198 Fix NameError: name sys is not defined (#920)
(cherry picked from commit 821b562)
1 parent cfa01ac commit f700158

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pymongo/uri_parser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,6 @@ def parse_uri(
552552

553553
if __name__ == "__main__":
554554
import pprint
555-
import sys
556555

557556
try:
558557
pprint.pprint(parse_uri(sys.argv[1]))

test/test_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,11 @@ def server_description_count():
16501650
# AssertionError: 4 != 22 within 5 delta (18 difference)
16511651
self.assertAlmostEqual(initial_count, final_count, delta=10)
16521652

1653+
@unittest.skipIf(_HAVE_DNSPYTHON, "dnspython must not be installed")
1654+
def test_srv_no_dnspython_error(self):
1655+
with self.assertRaisesRegex(ConfigurationError, 'The "dnspython" module must be'):
1656+
MongoClient("mongodb+srv://test1.test.build.10gen.cc/")
1657+
16531658

16541659
class TestExhaustCursor(IntegrationTest):
16551660
"""Test that clients properly handle errors from exhaust cursors."""

0 commit comments

Comments
 (0)