replace dash by space in pytest’s report

  pytest, python-3.x

I’m on my way to simplify a set of tests by pytest by stacking parameters

@pytest.mark.parametrize("option_a", ["-r", "-s"])
@pytest.mark.parametrize("option_b", ["--alpha", "--beta", "--gamma"])
def test_foo(option_a, option_b):
    assert option_a in ["-r", "-s"]

As anticipated, the above MWE performs an exhaustive permutation:

======================================= test session starts =======================================
platform linux -- Python 3.9.7, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/guest/Desktop/project, configfile: pytest.ini
collected 6 items                                                                         [--alpha--r] PASSED                                                   [ 16%][--alpha--s] PASSED                                                   [ 33%][--beta--r] PASSED                                                    [ 50%][--beta--s] PASSED                                                    [ 66%][--gamma--r] PASSED                                                   [ 83%][--gamma--s] PASSED                                                   [100%]

======================================== 6 passed in 0.02s ========================================

What bothers me a bit is the additional dash trailing the first parameter (--alpha, --beta, --gamma). Someone not familiar enough with pytest may assume the second parameter tested would be --r (instead of -r), or --s (instead of -s).

Is there a practical approach to substitute this separator by a blank space? Since this is just an issue how output to the CLI is formatted, I would like to refrain to define multiple fixtures for each test function.

Source: Python-3x Questions