mirror of https://github.com/pytest-dev/pytest.git
Merge 2718e9bced
into 103b2b67b0
This commit is contained in:
commit
bcd23765a8
|
@ -1327,10 +1327,11 @@ class Metafunc:
|
|||
# more than once) then we accumulate those calls generating the cartesian product
|
||||
# of all calls.
|
||||
newcalls = []
|
||||
for callspec in self._calls or [CallSpec2()]:
|
||||
for callspec_index, callspec in enumerate(self._calls or [CallSpec2()]):
|
||||
for param_index, (param_id, param_set) in enumerate(
|
||||
zip(ids, parametersets)
|
||||
):
|
||||
param_index = callspec_index * len(parametersets) + param_index
|
||||
newcallspec = callspec.setmulti(
|
||||
argnames=argnames,
|
||||
valset=param_set.values,
|
||||
|
|
|
@ -2834,12 +2834,12 @@ class TestFixtureMarker:
|
|||
test_mod2.py::test_func2[s2] PASSED
|
||||
test_mod2.py::test_func3[s2-m1] PASSED
|
||||
test_mod2.py::test_func3b[s2-m1] PASSED
|
||||
test_mod2.py::test_func4[m1] PASSED
|
||||
test_mod2.py::test_func3[s2-m2] PASSED
|
||||
test_mod2.py::test_func3b[s2-m2] PASSED
|
||||
test_mod2.py::test_func4[m2] PASSED
|
||||
test_mod1.py::test_func1[m1] PASSED
|
||||
test_mod1.py::test_func1[m2] PASSED
|
||||
test_mod2.py::test_func4[m1] PASSED
|
||||
test_mod2.py::test_func4[m2] PASSED
|
||||
"""
|
||||
)
|
||||
|
||||
|
@ -2885,10 +2885,10 @@ class TestFixtureMarker:
|
|||
test_dynamic_parametrized_ordering.py::test2[flavor1-vxlan] PASSED
|
||||
test_dynamic_parametrized_ordering.py::test[flavor1-vlan] PASSED
|
||||
test_dynamic_parametrized_ordering.py::test2[flavor1-vlan] PASSED
|
||||
test_dynamic_parametrized_ordering.py::test[flavor2-vlan] PASSED
|
||||
test_dynamic_parametrized_ordering.py::test2[flavor2-vlan] PASSED
|
||||
test_dynamic_parametrized_ordering.py::test[flavor2-vxlan] PASSED
|
||||
test_dynamic_parametrized_ordering.py::test2[flavor2-vxlan] PASSED
|
||||
test_dynamic_parametrized_ordering.py::test[flavor2-vlan] PASSED
|
||||
test_dynamic_parametrized_ordering.py::test2[flavor2-vlan] PASSED
|
||||
"""
|
||||
)
|
||||
|
||||
|
|
|
@ -1048,6 +1048,39 @@ class TestMetafunc:
|
|||
]
|
||||
)
|
||||
|
||||
def test_multi_parametrize_reordering(self, pytester: Pytester) -> None:
|
||||
pytester.makepyfile(
|
||||
"""
|
||||
import pytest
|
||||
|
||||
@pytest.mark.parametrize("arg2", ['a', 'b', 'c'], scope='class')
|
||||
@pytest.mark.parametrize("arg1", [1, 2], scope='class')
|
||||
class TestClass:
|
||||
def test1(self, arg1, arg2):
|
||||
pass
|
||||
|
||||
def test2(self, arg1, arg2):
|
||||
pass
|
||||
"""
|
||||
)
|
||||
result = pytester.runpytest("--collect-only")
|
||||
result.stdout.re_match_lines(
|
||||
[
|
||||
r" <Function test1\[1-a\]>",
|
||||
r" <Function test2\[1-a\]>",
|
||||
r" <Function test1\[1-b\]>",
|
||||
r" <Function test2\[1-b\]>",
|
||||
r" <Function test1\[1-c\]>",
|
||||
r" <Function test2\[1-c\]>",
|
||||
r" <Function test1\[2-a\]>",
|
||||
r" <Function test2\[2-a\]>",
|
||||
r" <Function test1\[2-b\]>",
|
||||
r" <Function test2\[2-b\]>",
|
||||
r" <Function test1\[2-c\]>",
|
||||
r" <Function test2\[2-c\]>",
|
||||
]
|
||||
)
|
||||
|
||||
def test_parametrize_multiple_times(self, pytester: Pytester) -> None:
|
||||
pytester.makepyfile(
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue