GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — parametrize with scope breaks fixture dependencies · Issue #13248 · pytest-dev/pytest Closed Labels topic: fixturesanything involving fixtures directly or indirectly DescriptionReproducer: import pytest @pytest.fixture(scope="session") def my_fixture(request): return getattr(request, "param", None) @pytest.fixture(scope="session") def another_fixture(my_fixture): return my_fixture @pytest.mark.parametrize("my_fixture", ["a"], indirect=True, scope="function") def test_foo(another_fixture): pass Produces the following error:
The bug is not reproduced consistently, it may be hidden if the fixture is already evaluated by a import pytest @pytest.fixture(scope="session") def my_fixture(request): return getattr(request, "param", None) @pytest.fixture(scope="session") def another_fixture(my_fixture): return my_fixture # autouse to make this fixture run first. @pytest.fixture(scope="function", autouse=True) def hack(my_fixture): pass @pytest.mark.parametrize("my_fixture", ["a"], indirect=True, scope="function") def test_foo(hack, another_fixture): pass This does not return any errors, works as expected. Activity
MetadataMetadataAssigneesLabelstopic: fixturesanything involving fixtures directly or indirectly TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |