Skip to content

Commit ccdc800

Browse files
committed
catch connection failure
1 parent 1988634 commit ccdc800

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

test/asynchronous/test_discovery_and_monitoring.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from test.utils_shared import delay
2929

3030
from pymongo.asynchronous.pool import AsyncConnection
31+
from pymongo.errors import ConnectionFailure
3132
from pymongo.operations import _Op
3233
from pymongo.server_selectors import writable_server_selector
3334

@@ -491,7 +492,7 @@ async def teardown():
491492
async def target():
492493
try:
493494
await client.test.test.find_one({"$where": delay(0.1)})
494-
except OperationFailure:
495+
except ConnectionFailure:
495496
pass
496497

497498
# Warm the pool with 10 tasks so there are existing connections.

test/test_discovery_and_monitoring.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from test.utils import flaky
2828
from test.utils_shared import delay
2929

30+
from pymongo.errors import ConnectionFailure
3031
from pymongo.operations import _Op
3132
from pymongo.server_selectors import writable_server_selector
3233
from pymongo.synchronous.pool import Connection
@@ -485,7 +486,7 @@ def teardown():
485486
def target():
486487
try:
487488
client.test.test.find_one({"$where": delay(0.1)})
488-
except OperationFailure:
489+
except ConnectionFailure:
489490
pass
490491

491492
# Warm the pool with 10 tasks so there are existing connections.

0 commit comments

Comments
 (0)