pytest-dev / pytest-dev/pytest

Make "-" argument separator in parametrised test logs configurable

Open
#14,201 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

Improve readability of test running reports

pytest uses the - character to separate test parameter values in logs. There is no official API to change this string.

A hacky was is:

from _pytest.python import CallSpec2

def pytest_sessionstart(session: Session) -> None:

    def format_idlist(self: CallSpec2) -> str:
        return " | ".join(filter(None, self._idlist))

    setattr(CallSpec2, "id", property(format_idlist))
Describe the solution you'd like

It would be nice to have either a variable or callable somewhere in Session to change - to any string, like |, for example.

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 tracing how _pytest.python.CallSpec2 builds its id from _idlist and how pytest_sessionstart can access session state. Check the existing test coverage around parametrised test reporting, then define and verify a supported variable or callable that changes the separator from "-" to a configured string such as "|".

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.