pytest-testdox icon indicating copy to clipboard operation
pytest-testdox copied to clipboard

Format output for parametrized tests

Open nejch opened this issue 2 years ago • 1 comments

Thanks for the nifty little package @renanivo!

I was wondering if it made sense to format parametrized tests, perhaps behind an opt-in flag/config option. For example:

@pytest.mark.parametrize("parameter", ["blue", "yellow", "green"])
def test_passes_with_parameters(parameter):
    assert True

So you'd go from:

test_demo.py

demo
  ✓ passes with parameters[blue]
  ✓ passes with parameters[yellow]
  ✓ passes with parameters[green]

To:

test_demo.py

demo
  ✓ passes with parameters
    ✓ blue
    ✓ yellow
    ✓ green

Or something like that :) maybe without the on the root-level, whichever is easier and makes more sense.

nejch avatar May 27 '22 07:05 nejch

Hi @nejch. Thanks for your suggestion.

That's something I always wanted to do, but never started. As you have mentioned, the ✓ at the root level would be harder to do because it would require us to wait for the child nodes to execute before printing it, which might be troublesome when an exception happens.

I added the "feature request" label and will probably start working on it in the next couple weeks, but if you (or anyone else) want to do it, just let me know 🙂

renanivo avatar May 27 '22 21:05 renanivo