<div dir="ltr"><div>I like very much that by using multiple parametrization decorators I can test the permutations of a number of argvalues sequences of different lengths. Here is an example with argvalues sequences of cardinality 4, 3, and 2, respectively:<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div><span style="font-family:monospace,monospace"># params.py<br></span></div></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div><span style="font-family:monospace,monospace">import pytest</span> <br></div></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span style="font-family:monospace,monospace">@pytest.mark.parametrize(&#39;a&#39;, [i for i in range(1, 5)])</span><br><span style="font-family:monospace,monospace">@pytest.mark.parametrize(&#39;b&#39;, [i ** 3 for i in range(1, 4)])</span><br><span style="font-family:monospace,monospace">@pytest.mark.parametrize(&#39;c&#39;, [i ** 5 for i in range(1, 3)])                    </span><br><span style="font-family:monospace,monospace">def test_funcs(a, b, c):             </span><br><span style="font-family:monospace,monospace">    assert (a + b) ** 2 != c ** 2    </span><br></blockquote><span style="font-family:monospace,monospace"></span><br>All 24 permutations run once:<br><br></div><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span style="font-family:monospace,monospace">$ py.test params.py</span><br><span style="font-family:monospace,monospace">============================= test session starts ==============================</span><br><span style="font-family:monospace,monospace">platform darwin -- Python 3.4.2 -- py-1.4.26 -- pytest-2.6.4</span><br><span style="font-family:monospace,monospace">collected 24 items </span><br><span style="font-family:monospace,monospace"></span><br><span style="font-family:monospace,monospace">params/param5.py ........................</span><br><span style="font-family:monospace,monospace"></span><br><span style="font-family:monospace,monospace">========================== 24 passed in 0.03 seconds ===========================</span><br><span style="font-family:monospace,monospace">$</span><br><span style="font-family:monospace,monospace"></span></blockquote><br>But I wonder if there is a way to do this in a single expression, rather than as nested decorators.<br><br></div>- dpb<br></div>