Skip to content

Commit 37be166

Browse files
committed
Address review
1 parent 10406de commit 37be166

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

test/asynchronous/test_client.py

-1
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,6 @@ async def test_direct_connection(self):
19071907
AsyncMongoClient(["host1", "host2"], directConnection=True)
19081908

19091909
@unittest.skipIf("PyPy" in sys.version, "PYTHON-2927 fails often on PyPy")
1910-
@skipIf(os.environ.get("DEBUG_LOG"), "Enabling debug logs breaks this test")
19111910
async def test_continuous_network_errors(self):
19121911
def server_description_count():
19131912
i = 0

test/asynchronous/test_discovery_and_monitoring.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,15 @@ async def mock_close(self, reason):
433433
await listener.async_wait_for_event(monitoring.ServerHeartbeatFailedEvent, 1)
434434
# Wait until all idle connections are closed to simulate real-world conditions
435435
await listener.async_wait_for_event(monitoring.ConnectionClosedEvent, 10)
436+
# Wait for one more find to complete after the pool has been reset, then shutdown the task
437+
n = len(latencies)
438+
await async_wait_until(lambda: len(latencies) >= n + 1, "run one more find")
436439
should_exit.append(True)
440+
await task.join()
437441
# No operation latency should not significantly exceed close_delay
438442
self.assertLessEqual(max(latencies), close_delay * 5.0)
439443
finally:
440444
AsyncConnection.close_conn = original_close
441-
await task.join()
442445

443446

444447
class TestServerMonitoringMode(AsyncIntegrationTest):

test/test_client.py

-1
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,6 @@ def test_direct_connection(self):
18641864
MongoClient(["host1", "host2"], directConnection=True)
18651865

18661866
@unittest.skipIf("PyPy" in sys.version, "PYTHON-2927 fails often on PyPy")
1867-
@skipIf(os.environ.get("DEBUG_LOG"), "Enabling debug logs breaks this test")
18681867
def test_continuous_network_errors(self):
18691868
def server_description_count():
18701869
i = 0

test/test_discovery_and_monitoring.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,15 @@ def mock_close(self, reason):
431431
listener.wait_for_event(monitoring.ServerHeartbeatFailedEvent, 1)
432432
# Wait until all idle connections are closed to simulate real-world conditions
433433
listener.wait_for_event(monitoring.ConnectionClosedEvent, 10)
434+
# Wait for one more find to complete after the pool has been reset, then shutdown the task
435+
n = len(latencies)
436+
wait_until(lambda: len(latencies) >= n + 1, "run one more find")
434437
should_exit.append(True)
438+
task.join()
435439
# No operation latency should not significantly exceed close_delay
436440
self.assertLessEqual(max(latencies), close_delay * 5.0)
437441
finally:
438442
Connection.close_conn = original_close
439-
task.join()
440443

441444

442445
class TestServerMonitoringMode(IntegrationTest):

0 commit comments

Comments
 (0)