Skip to content

Commit c1273fb

Browse files
committed
PYTHON-5784 Replace pe_module alias with periodic_executor
1 parent b646e43 commit c1273fb

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

test/asynchronous/test_periodic_executor.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
from test.asynchronous import AsyncUnitTest, unittest
2828

29-
import pymongo.periodic_executor as pe_module
29+
from pymongo import periodic_executor
3030
from pymongo.periodic_executor import (
3131
AsyncPeriodicExecutor,
3232
_register_executor,
@@ -251,21 +251,21 @@ class TestRegisterExecutor(AsyncUnitTest):
251251
if _IS_SYNC:
252252

253253
def setUp(self):
254-
self._orig = set(pe_module._EXECUTORS)
254+
self._orig = set(periodic_executor._EXECUTORS)
255255

256256
def tearDown(self):
257-
pe_module._EXECUTORS.clear()
258-
pe_module._EXECUTORS.update(self._orig)
257+
periodic_executor._EXECUTORS.clear()
258+
periodic_executor._EXECUTORS.update(self._orig)
259259

260260
def test_register_adds_weakref(self):
261261
ex = _make_executor()
262-
before = len(pe_module._EXECUTORS)
262+
before = len(periodic_executor._EXECUTORS)
263263
_register_executor(ex)
264-
self.assertEqual(len(pe_module._EXECUTORS), before + 1)
265-
ref = next(r for r in pe_module._EXECUTORS if r() is ex)
264+
self.assertEqual(len(periodic_executor._EXECUTORS), before + 1)
265+
ref = next(r for r in periodic_executor._EXECUTORS if r() is ex)
266266
del ex
267267
gc.collect()
268-
self.assertNotIn(ref, pe_module._EXECUTORS)
268+
self.assertNotIn(ref, periodic_executor._EXECUTORS)
269269

270270
def test_shutdown_executors_stops_running_executors(self):
271271
ran = threading.Event()
@@ -282,7 +282,7 @@ def target():
282282
self.assertTrue(ex._stopped)
283283

284284
def test_shutdown_executors_safe_when_empty(self):
285-
pe_module._EXECUTORS.clear()
285+
periodic_executor._EXECUTORS.clear()
286286
_shutdown_executors()
287287

288288

test/test_periodic_executor.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
from test import UnitTest, unittest
2828

29-
import pymongo.periodic_executor as pe_module
29+
from pymongo import periodic_executor
3030
from pymongo.periodic_executor import (
3131
PeriodicExecutor,
3232
_register_executor,
@@ -249,21 +249,21 @@ class TestRegisterExecutor(UnitTest):
249249
if _IS_SYNC:
250250

251251
def setUp(self):
252-
self._orig = set(pe_module._EXECUTORS)
252+
self._orig = set(periodic_executor._EXECUTORS)
253253

254254
def tearDown(self):
255-
pe_module._EXECUTORS.clear()
256-
pe_module._EXECUTORS.update(self._orig)
255+
periodic_executor._EXECUTORS.clear()
256+
periodic_executor._EXECUTORS.update(self._orig)
257257

258258
def test_register_adds_weakref(self):
259259
ex = _make_executor()
260-
before = len(pe_module._EXECUTORS)
260+
before = len(periodic_executor._EXECUTORS)
261261
_register_executor(ex)
262-
self.assertEqual(len(pe_module._EXECUTORS), before + 1)
263-
ref = next(r for r in pe_module._EXECUTORS if r() is ex)
262+
self.assertEqual(len(periodic_executor._EXECUTORS), before + 1)
263+
ref = next(r for r in periodic_executor._EXECUTORS if r() is ex)
264264
del ex
265265
gc.collect()
266-
self.assertNotIn(ref, pe_module._EXECUTORS)
266+
self.assertNotIn(ref, periodic_executor._EXECUTORS)
267267

268268
def test_shutdown_executors_stops_running_executors(self):
269269
ran = threading.Event()
@@ -280,7 +280,7 @@ def target():
280280
self.assertTrue(ex._stopped)
281281

282282
def test_shutdown_executors_safe_when_empty(self):
283-
pe_module._EXECUTORS.clear()
283+
periodic_executor._EXECUTORS.clear()
284284
_shutdown_executors()
285285

286286

0 commit comments

Comments
 (0)