pytest-dev / pytest-dev/pytest

pytest could do a better job printing fixture selection info

Open
#8,313 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: fixtures topic: parametrize topic: reporting type: proposal
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

What's the problem this feature will solve?

currently, when one uses a fixture to select between multiple values, say

@pytest.fixture(scope="session", params=[False, True])
def tags(request):
    return request.param

it just prints out "True" or "False" when saying what its running.

ala

tests/tests.py::TestClass::test_func[True]

it be nicer if printed something like

tests/tests.py::TestClass::test_func[tags=True]
Describe the solution you'd like

a clearer printout so one doesn't have to dig into the code each time to be reminded what the fixture is.

Alternative Solutions

N/A

Additional context

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the fixture example using params=[False, True] and observe the collected test IDs. Trace how pytest formats fixture parameter values in the reported test name; done means the output identifies the fixture alongside its value, with tests covering the clearer format.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.