Pickup addition positional args passed to _parse_parametrize_ar… (#5483)
Pickup addition positional args passed to _parse_parametrize_args
This commit is contained in:
commit
37fce6c6e5
1
AUTHORS
1
AUTHORS
|
@ -135,6 +135,7 @@ Kale Kundert
|
|||
Katarzyna Jachim
|
||||
Katerina Koukiou
|
||||
Kevin Cox
|
||||
Kevin J. Foley
|
||||
Kodi B. Arfer
|
||||
Kostis Anagnostopoulos
|
||||
Kristoffer Nordström
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Fix bug introduced in 4.6.0 causing collection errors when passing
|
||||
more than 2 positional arguments to ``pytest.mark.parametrize``.
|
|
@ -102,10 +102,7 @@ class ParameterSet(namedtuple("ParameterSet", "values, marks, id")):
|
|||
return cls(parameterset, marks=[], id=None)
|
||||
|
||||
@staticmethod
|
||||
def _parse_parametrize_args(argnames, argvalues, **_):
|
||||
"""It receives an ignored _ (kwargs) argument so this function can
|
||||
take also calls from parametrize ignoring scope, indirect, and other
|
||||
arguments..."""
|
||||
def _parse_parametrize_args(argnames, argvalues, *args, **kwargs):
|
||||
if not isinstance(argnames, (tuple, list)):
|
||||
argnames = [x.strip() for x in argnames.split(",") if x.strip()]
|
||||
force_tuple = len(argnames) == 1
|
||||
|
|
|
@ -1761,3 +1761,16 @@ class TestMarkersWithParametrization:
|
|||
result.stdout.fnmatch_lines(
|
||||
["*test_func_a*0*PASS*", "*test_func_a*2*PASS*", "*test_func_b*10*PASS*"]
|
||||
)
|
||||
|
||||
def test_parametrize_positional_args(self, testdir):
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
import pytest
|
||||
|
||||
@pytest.mark.parametrize("a", [1], False)
|
||||
def test_foo(a):
|
||||
pass
|
||||
"""
|
||||
)
|
||||
result = testdir.runpytest()
|
||||
result.assert_outcomes(passed=1)
|
||||
|
|
Loading…
Reference in New Issue