New issue 531: Problems with fixture parametrization https://bitbucket.org/hpk42/pytest/issue/531/problems-with-fixture-parametrization
Nikolaus Rath: Please consider the attached test. In this form, it runs just fine: ``` text $ py.test-3 -v -s test_bug.py =========================== test session starts ============================ platform linux -- Python 3.4.1 -- py-1.4.20 -- pytest-2.5.2 -- /usr/bin/python3 collected 3 items test_bug.py:31: test_one[val1-globorz] PASSED test_bug.py:34: test_two[val1-globorz] PASSED test_bug.py:31: test_one[val2-globorz] PASSED ========================= 3 passed in 0.01 seconds ========================= ``` However, if you reverse the order of the first fixture parametrization, i.e. if you use ``` values = [ Container('val2'), Container('val1') ] ``` instead of ``` values = [ Container('val1'), Container('val2') ] ``` the test suddenly fails with: ``` text test_bug.py:31: test_one[val2-globorz] PASSED test_bug.py:34: test_two[val1-globorz] FAILED test_bug.py:31: test_one[val1-globorz] PASSED ================================= FAILURES ================================= __________________________ test_two[val1-globorz] __________________________ fix1 = (<test_bug.Container object at 0x7f9574bf5cc0>, 'globorz') def test_two(fix1): > assert fix1[0].v == 'val1' E assert 'val2' == 'val1' E - val2 E ? ^ E + val1 E ? ^ test_bug.py:35: AssertionError ``` It seems that py.test thinks that it is passing "val1" to test_two, but it actually passes "val2". _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit