Skip to content

Commit dfa0639

Browse files
committed
cleanup
1 parent ad20606 commit dfa0639

File tree

8 files changed

+8
-18
lines changed

8 files changed

+8
-18
lines changed

pymongo/asynchronous/topology.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ async def _process_srv_update(self, seedlist: list[tuple[str, Any]]) -> None:
567567
if td_old.topology_type not in SRV_POLLING_TOPOLOGIES:
568568
return
569569
self._description = _updated_topology_description_srv_polling(self._description, seedlist)
570+
570571
await self._update_servers()
571572

572573
if self._publish_tp:
@@ -982,6 +983,7 @@ def _create_pool_for_monitor(self, address: _Address) -> Pool:
982983
pause_enabled=False,
983984
server_api=options.server_api,
984985
)
986+
985987
return self._settings.pool_class(
986988
address, monitor_pool_options, handshake=False, client_id=self._topology_id
987989
)

pymongo/synchronous/topology.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ def _process_srv_update(self, seedlist: list[tuple[str, Any]]) -> None:
567567
if td_old.topology_type not in SRV_POLLING_TOPOLOGIES:
568568
return
569569
self._description = _updated_topology_description_srv_polling(self._description, seedlist)
570+
570571
self._update_servers()
571572

572573
if self._publish_tp:
@@ -980,6 +981,7 @@ def _create_pool_for_monitor(self, address: _Address) -> Pool:
980981
pause_enabled=False,
981982
server_api=options.server_api,
982983
)
984+
983985
return self._settings.pool_class(
984986
address, monitor_pool_options, handshake=False, client_id=self._topology_id
985987
)

test/asynchronous/test_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,6 @@ async def test_repr(self):
903903
connect=False,
904904
document_class=SON,
905905
)
906-
await client.aconnect()
907906
the_repr = repr(client)
908907
self.assertIn("AsyncMongoClient(host=", the_repr)
909908
self.assertIn("document_class=bson.son.SON, tz_aware=False, connect=False, ", the_repr)
@@ -925,7 +924,6 @@ async def test_repr(self):
925924
wtimeoutms=100,
926925
connect=False,
927926
)
928-
await client.aconnect()
929927
the_repr = repr(client)
930928
self.assertIn("AsyncMongoClient(host=", the_repr)
931929
self.assertIn("document_class=dict, tz_aware=False, connect=False, ", the_repr)
@@ -1623,8 +1621,7 @@ def init(self, *args):
16231621
async def test_small_heartbeat_frequency_ms(self):
16241622
uri = "mongodb://example/?heartbeatFrequencyMS=499"
16251623
with self.assertRaises(ConfigurationError) as context:
1626-
client = AsyncMongoClient(uri)
1627-
await client.aconnect()
1624+
AsyncMongoClient(uri)
16281625

16291626
self.assertIn("heartbeatFrequencyMS", str(context.exception))
16301627

test/asynchronous/test_dns.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ async def run_test(self):
141141
# Our test certs don't support the SRV hosts used in these
142142
# tests.
143143
copts["tlsAllowInvalidHostnames"] = True
144+
144145
client = self.simple_client(uri, **copts)
145146
if client._options.connect:
146147
await client.aconnect()

test/asynchronous/unified_format.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,6 @@ def check_events(self, spec):
12901290
)
12911291

12921292
for idx, expected_event in enumerate(events):
1293-
print(expected_event, actual_events[idx])
12941293
self.match_evaluator.match_event(expected_event, actual_events[idx])
12951294

12961295
if has_server_connection_id:
@@ -1345,8 +1344,6 @@ def format_logs(log_list):
13451344
ignore_logs = client.get("ignoreMessages", [])
13461345
if ignore_logs:
13471346
actual_logs = self.process_ignore_messages(ignore_logs, actual_logs)
1348-
print(f"{ignore_logs=}")
1349-
print(f"{actual_logs=}")
13501347

13511348
if client.get("ignoreExtraMessages", False):
13521349
actual_logs = actual_logs[: len(client["messages"])]
@@ -1357,8 +1354,6 @@ def format_logs(log_list):
13571354
)
13581355
for expected_msg, actual_msg in zip(client["messages"], actual_logs):
13591356
expected_data, actual_data = expected_msg.pop("data"), actual_msg.pop("data")
1360-
print(f"{expected_data=}")
1361-
print(f"{actual_data=}")
13621357
if "failureIsRedacted" in expected_msg:
13631358
self.assertIn("failure", actual_data)
13641359
should_redact = expected_msg.pop("failureIsRedacted")

test/test_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,6 @@ def test_repr(self):
878878
connect=False,
879879
document_class=SON,
880880
)
881-
client._connect()
882881
the_repr = repr(client)
883882
self.assertIn("MongoClient(host=", the_repr)
884883
self.assertIn("document_class=bson.son.SON, tz_aware=False, connect=False, ", the_repr)
@@ -900,7 +899,6 @@ def test_repr(self):
900899
wtimeoutms=100,
901900
connect=False,
902901
)
903-
client._connect()
904902
the_repr = repr(client)
905903
self.assertIn("MongoClient(host=", the_repr)
906904
self.assertIn("document_class=dict, tz_aware=False, connect=False, ", the_repr)
@@ -1580,8 +1578,7 @@ def init(self, *args):
15801578
def test_small_heartbeat_frequency_ms(self):
15811579
uri = "mongodb://example/?heartbeatFrequencyMS=499"
15821580
with self.assertRaises(ConfigurationError) as context:
1583-
client = MongoClient(uri)
1584-
client._connect()
1581+
MongoClient(uri)
15851582

15861583
self.assertIn("heartbeatFrequencyMS", str(context.exception))
15871584

test/test_dns.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ def run_test(self):
141141
# Our test certs don't support the SRV hosts used in these
142142
# tests.
143143
copts["tlsAllowInvalidHostnames"] = True
144+
144145
client = self.simple_client(uri, **copts)
145146
if client._options.connect:
146147
client._connect()

test/unified_format.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,6 @@ def check_events(self, spec):
12771277
)
12781278

12791279
for idx, expected_event in enumerate(events):
1280-
print(expected_event, actual_events[idx])
12811280
self.match_evaluator.match_event(expected_event, actual_events[idx])
12821281

12831282
if has_server_connection_id:
@@ -1332,8 +1331,6 @@ def format_logs(log_list):
13321331
ignore_logs = client.get("ignoreMessages", [])
13331332
if ignore_logs:
13341333
actual_logs = self.process_ignore_messages(ignore_logs, actual_logs)
1335-
print(f"{ignore_logs=}")
1336-
print(f"{actual_logs=}")
13371334

13381335
if client.get("ignoreExtraMessages", False):
13391336
actual_logs = actual_logs[: len(client["messages"])]
@@ -1344,8 +1341,6 @@ def format_logs(log_list):
13441341
)
13451342
for expected_msg, actual_msg in zip(client["messages"], actual_logs):
13461343
expected_data, actual_data = expected_msg.pop("data"), actual_msg.pop("data")
1347-
print(f"{expected_data=}")
1348-
print(f"{actual_data=}")
13491344
if "failureIsRedacted" in expected_msg:
13501345
self.assertIn("failure", actual_data)
13511346
should_redact = expected_msg.pop("failureIsRedacted")

0 commit comments

Comments
 (0)