Skip to content

Commit 99c3815

Browse files
committed
fix reset_client_context
1 parent 938c8a7 commit 99c3815

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

pymongo/asynchronous/monitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def __init__(
138138
"""
139139
super().__init__(
140140
topology,
141-
"pymongo_server_monitor_thread",
141+
"pymongo_server_monitor_task",
142142
topology_settings.heartbeat_frequency,
143143
common.MIN_HEARTBEAT_INTERVAL,
144144
)

pymongo/periodic_executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import weakref
2424
from typing import Any, Optional
2525

26-
from pymongo.lock import _ALock, _create_lock
26+
from pymongo.lock import _create_lock
2727

2828
_IS_SYNC = False
2929

pymongo/synchronous/monitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def __init__(
138138
"""
139139
super().__init__(
140140
topology,
141-
"pymongo_server_monitor_thread",
141+
"pymongo_server_monitor_task",
142142
topology_settings.heartbeat_frequency,
143143
common.MIN_HEARTBEAT_INTERVAL,
144144
)

test/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,9 +866,9 @@ def reset_client_context():
866866
if _IS_SYNC:
867867
# sync tests don't need to recreate a client context
868868
return
869-
teardown()
870-
client_context.reset()
871-
setup()
869+
client_context.client.close()
870+
client_context.client = None
871+
client_context._init_client()
872872

873873

874874
class PyMongoTestCase(unittest.TestCase):

test/asynchronous/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -868,9 +868,9 @@ async def reset_client_context():
868868
if _IS_SYNC:
869869
# sync tests don't need to recreate a client context
870870
return
871-
await async_teardown()
872-
async_client_context.reset()
873-
await async_setup()
871+
await async_client_context.client.close()
872+
async_client_context.client = None
873+
await async_client_context._init_client()
874874

875875

876876
class AsyncPyMongoTestCase(unittest.IsolatedAsyncioTestCase):

0 commit comments

Comments
 (0)