summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorolly <olly@ollycope.com>2015-03-14 18:10:30 +0000
committerolly <olly@ollycope.com>2015-03-14 18:10:30 +0000
commitc76906feea6e42858e9cf99d499f4a3ffd5112ba (patch)
treea43042c4ce114bc4bec2d3720596e214bf1380ad
parent2eed14f732a3c2108b17922b04a27d83bdc3f81f (diff)
downloadyoyo-c76906feea6e42858e9cf99d499f4a3ffd5112ba.tar.gz
Remove @wraps to avoid confusing pytest
For reasons I don't quite understand, pytest's introspection misreads the arguments to the decorated function and erroneously tries to provide fixture data. Removing the @wraps call seems to fix this.
-rw-r--r--yoyo/tests/__init__.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/yoyo/tests/__init__.py b/yoyo/tests/__init__.py
index 85e1ee7..b4d6af3 100644
--- a/yoyo/tests/__init__.py
+++ b/yoyo/tests/__init__.py
@@ -1,4 +1,3 @@
-from functools import wraps
from tempfile import mkdtemp
from shutil import rmtree
import os.path
@@ -20,13 +19,12 @@ def with_migrations(*migrations):
return re.sub(r'(^|[\r\n]){0}'.format(re.escape(initial_indent)),
r'\1', s)
- def decorator(func):
+ def add_migrations_dir(func):
tmpdir = mkdtemp()
for ix, code in enumerate(migrations):
with open(os.path.join(tmpdir, '{0}.py'.format(ix)), 'w') as f:
f.write(unindent(code).strip())
- @wraps(func)
def decorated(*args, **kwargs):
args = args + (tmpdir,)
try:
@@ -35,4 +33,5 @@ def with_migrations(*migrations):
rmtree(tmpdir)
return decorated
- return decorator
+
+ return add_migrations_dir