Skip to content

Commit 6532bb2

Browse files
committed
Refactor.
1 parent 671d100 commit 6532bb2

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

mocket/async_mocket.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import decorator
2-
31
from mocket import Mocketizer
42

53

@@ -12,25 +10,8 @@ async def __aexit__(*args, **kwargs):
1210
return Mocketizer.__exit__(*args, **kwargs)
1311

1412
@staticmethod
15-
def async_wrap(test=None, truesocket_recording_dir=None):
16-
async def wrapper(t, *args, **kw):
17-
instance = args[0] if args else None
18-
namespace = ".".join(
19-
(
20-
instance.__class__.__module__,
21-
instance.__class__.__name__,
22-
t.__name__,
23-
)
24-
)
25-
async with AsyncMocketizer(
26-
instance,
27-
namespace=namespace,
28-
truesocket_recording_dir=truesocket_recording_dir,
29-
):
30-
await t(*args, **kw)
31-
return wrapper
32-
33-
return decorator.decorator(wrapper, test)
13+
def async_wrap(*args, **kwargs):
14+
return Mocketizer.wrap(*args, **kwargs)
3415

3516
return AsyncMocketizer.async_wrap
3617

0 commit comments

Comments
 (0)