Skip to content

Commit dcfe937

Browse files
committed
make wrap seperate for sync and async
1 parent ee7b621 commit dcfe937

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/helpers.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,16 @@ def __exit__(self, exc_type, exc_val, exc_tb):
206206
def __call__(self, func):
207207
def make_wrapper(f):
208208
if iscoroutinefunction(f):
209-
wraps_async = True
210-
else:
211-
wraps_async = False
212209

213-
@wraps(f)
214-
async def wrap(*args, **kwargs):
215-
with self:
216-
if wraps_async:
210+
@wraps(f)
211+
async def wrap(*args, **kwargs):
212+
with self:
217213
return await f(*args, **kwargs)
218-
else:
214+
else:
215+
216+
@wraps(f)
217+
def wrap(*args, **kwargs):
218+
with self:
219219
return f(*args, **kwargs)
220220

221221
return wrap

0 commit comments

Comments
 (0)