Make parametrize example deterministic

This commit is contained in:
Bruno Oliveira 2016-08-03 16:48:11 -04:00
parent 72df32f1fd
commit d28801d794
1 changed files with 4 additions and 5 deletions

View File

@ -346,7 +346,7 @@ parametrizer`_ but in a lot less code::
def pytest_generate_tests(metafunc): def pytest_generate_tests(metafunc):
# called once per each test function # called once per each test function
funcarglist = metafunc.cls.params[metafunc.function.__name__] funcarglist = metafunc.cls.params[metafunc.function.__name__]
argnames = list(funcarglist[0]) argnames = sorted(funcarglist[0])
metafunc.parametrize(argnames, [[funcargs[name] for name in argnames] metafunc.parametrize(argnames, [[funcargs[name] for name in argnames]
for funcargs in funcarglist]) for funcargs in funcarglist])
@ -397,11 +397,10 @@ is to be run with different sets of arguments for its three arguments:
Running it results in some skips if we don't have all the python interpreters installed and otherwise runs all combinations (5 interpreters times 5 interpreters times 3 objects to serialize/deserialize):: Running it results in some skips if we don't have all the python interpreters installed and otherwise runs all combinations (5 interpreters times 5 interpreters times 3 objects to serialize/deserialize)::
. $ pytest -rs -q multipython.py . $ pytest -rs -q multipython.py
ssssssssssss...ssssssssssss sssssssssssssss.........sss.........sss.........
======= short test summary info ======== ======= short test summary info ========
SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python2.6' not found SKIP [21] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python2.6' not found
SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python3.3' not found 27 passed, 21 skipped in 0.12 seconds
3 passed, 24 skipped in 0.12 seconds
Indirect parametrization of optional implementations/imports Indirect parametrization of optional implementations/imports
-------------------------------------------------------------------- --------------------------------------------------------------------