Hello, I don't understand why the following test fixture works for the test function, but fails for the test method. Am I doing something wrong, or is this a bug?
$ cat t0_mine.py import pytest import unittest @pytest.yield_fixture(params=(0,1,2)) def param1(request): if request.param == 1: pytest.skip('not so good') yield request.param @pytest.fixture(params=('a','b')) def param2(request, param1): return (param1, request.param) @pytest.fixture() def param1a(request, param1): if param1 == 1: return 0 else: return 7 def test_function(param2, param1a): if param2[0] == 1: assert param1a == 0 else: assert param1a == 7 @pytest.mark.usefixtures('param2', 'param1a') $ py.test-3 t0_mine.py -v ==================================== test session starts ==================================== platform linux -- Python 3.3.3 -- pytest-2.5.1 -- /usr/bin/python3 collected 7 items t0_mine.py:25: test_function[a-0] PASSED t0_mine.py:25: test_function[a-1] SKIPPED t0_mine.py:25: test_function[a-2] PASSED t0_mine.py:25: test_function[b-0] PASSED t0_mine.py:25: test_function[b-1] SKIPPED t0_mine.py:25: test_function[b-2] PASSED t0_mine.py:33: TestClass.test_method ERROR ========================================== ERRORS =========================================== __________________________ ERROR at setup of TestClass.test_method __________________________ request = <SubRequest 'param1' for <TestCaseFunction 'test_method'>> @pytest.yield_fixture(params=(0,1,2)) def param1(request): > if request.param == 1: E AttributeError: 'SubRequest' object has no attribute 'param' t0_mine.py:9: AttributeError ======================= 4 passed, 2 skipped, 1 error in 0.02 seconds ======================== Best, Nikolaus -- Encrypted emails preferred. PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C »Time flies like an arrow, fruit flies like a Banana.« _______________________________________________ Pytest-dev mailing list Pytest-dev@python.org https://mail.python.org/mailman/listinfo/pytest-dev