Skip to content

Commit d28801d

Browse files
committed
Make parametrize example deterministic
1 parent 72df32f commit d28801d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

doc/en/example/parametrize.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ parametrizer`_ but in a lot less code::
346346
def pytest_generate_tests(metafunc):
347347
# called once per each test function
348348
funcarglist = metafunc.cls.params[metafunc.function.__name__]
349-
argnames = list(funcarglist[0])
349+
argnames = sorted(funcarglist[0])
350350
metafunc.parametrize(argnames, [[funcargs[name] for name in argnames]
351351
for funcargs in funcarglist])
352352

@@ -397,11 +397,10 @@ is to be run with different sets of arguments for its three arguments:
397397
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)::
398398

399399
. $ pytest -rs -q multipython.py
400-
ssssssssssss...ssssssssssss
400+
sssssssssssssss.........sss.........sss.........
401401
======= short test summary info ========
402-
SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python2.6' not found
403-
SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python3.3' not found
404-
3 passed, 24 skipped in 0.12 seconds
402+
SKIP [21] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python2.6' not found
403+
27 passed, 21 skipped in 0.12 seconds
405404

406405
Indirect parametrization of optional implementations/imports
407406
--------------------------------------------------------------------

0 commit comments

Comments
 (0)