mirror of
https://github.com/wassname/catalyst.git
synced 2026-10-04 12:30:07 +08:00
TEST: Allow parameter_space to work on repeated calls of test
If we have a test that's being called more than once (i.e. two test cases, both subclasses of the same base test case, with different setup but calling the same test), allow the subsequent calls to re-consume the same params
This commit is contained in:
1 parent
38367b6794
commit
cb6c5f09a6
1 file changed
+7
-3
@@ -1142,16 +1142,20 @@ def parameter_space(__fail_fast=False, **params):
|
||||
"supplied to parameter_space()." % extra
|
||||
)
|
||||
|
||||
param_sets = product(*(params[name] for name in argnames))
|
||||
make_param_sets = lambda: product(*(params[name] for name in argnames))
|
||||
|
||||
if __fail_fast:
|
||||
@wraps(f)
|
||||
def wrapped(self):
|
||||
for args in param_sets:
|
||||
for args in make_param_sets():
|
||||
f(self, *args)
|
||||
return wrapped
|
||||
else:
|
||||
return subtest(param_sets, *argnames)(f)
|
||||
@wraps(f)
|
||||
def wrapped(*args, **kwargs):
|
||||
subtest(make_param_sets(), *argnames)(f)(*args, **kwargs)
|
||||
|
||||
return wrapped
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
Reference in new issue
Block a user