Skip to content

Commit 188be9c

Browse files
committed
make helpers an async file to clean up code
1 parent dcfe937 commit 188be9c

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

test/asynchronous/test_retryable_writes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
AsyncIntegrationTest,
2828
SkipTest,
2929
async_client_context,
30-
client_knobs,
3130
unittest,
3231
)
32+
from test.asynchronous.helpers import client_knobs
3333
from test.utils import (
3434
CMAPListener,
3535
DeprecationFilter,

test/helpers.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
if HAVE_SSL:
4949
import ssl
5050

51+
_IS_SYNC = True
52+
5153
# Enable debug output for uncollectable objects. PyPy does not have set_debug.
5254
if hasattr(gc, "set_debug"):
5355
gc.set_debug(
@@ -205,18 +207,10 @@ def __exit__(self, exc_type, exc_val, exc_tb):
205207

206208
def __call__(self, func):
207209
def make_wrapper(f):
208-
if iscoroutinefunction(f):
209-
210-
@wraps(f)
211-
async def wrap(*args, **kwargs):
212-
with self:
213-
return await f(*args, **kwargs)
214-
else:
215-
216-
@wraps(f)
217-
def wrap(*args, **kwargs):
218-
with self:
219-
return f(*args, **kwargs)
210+
@wraps(f)
211+
def wrap(*args, **kwargs):
212+
with self:
213+
return f(*args, **kwargs)
220214

221215
return wrap
222216

test/test_retryable_writes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
IntegrationTest,
2828
SkipTest,
2929
client_context,
30-
client_knobs,
3130
unittest,
3231
)
32+
from test.helpers import client_knobs
3333
from test.utils import (
3434
CMAPListener,
3535
DeprecationFilter,

tools/synchro.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
converted_tests = [
163163
"__init__.py",
164164
"conftest.py",
165+
"helpers.py",
165166
"pymongo_mocks.py",
166167
"utils_spec_runner.py",
167168
"qcheck.py",

0 commit comments

Comments
 (0)