Skip to content

--fixtures-per-test: Exclude parametrizing pseudo fixtures? #11295

@The-Compiler

Description

@The-Compiler

With something like:

import pytest def test_one(monkeypatch): pass @pytest.mark.parametrize("x", [1, 2]) def test_two(x): pass

running pytest --fixtures-per-test results in:

-------------------------- fixtures used by test_one --------------------------- ----------------------------------- (x.py:4) ----------------------------------- monkeypatch -- .../_pytest/monkeypatch.py:30 A convenient fixture for monkey-patching. ------------------------- fixtures used by test_two[1] ------------------------- ----------------------------------- (x.py:7) ----------------------------------- x -- .../_pytest/fixtures.py:352 no docstring available ------------------------- fixtures used by test_two[2] ------------------------- ----------------------------------- (x.py:7) ----------------------------------- x -- .../_pytest/fixtures.py:352 no docstring available 

IMHO, the output for x should be excluded here - while it is technically a (pseudo) fixture internally, showing it like that is rather confusing for users. It doesn't make sense to show it as a fixture without a docstring which is "defined" here:

def get_direct_param_fixture_func(request: "FixtureRequest") -> Any:
return request.param

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: fixturesanything involving fixtures directly or indirectlytopic: reportingrelated to terminal output and user-facing messages and errors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions