pytest icon indicating copy to clipboard operation
pytest copied to clipboard

terminal: include markers in `--collect-only` output

Open cj-timothy-sampson opened this issue 1 year ago • 0 comments

Closes #1509

Note that I haven't done these yet:

  • [ ] Include documentation when adding new features.
  • [ ] Include new tests or update existing tests when applicable. (I've updated the tests so that they should pass but new tests should be added)

As I have a few questions about how this should work and intend this PR to be a jumping off point for a conversation (as per @RonnyPfannschmidt 's suggestion in #1509).

My questions are:

  • currently this will only display when --verbosity=-1. On one hand this feels reasonable as that outputs one test per line and for grepping purposes that makes most sense. However it feels then a bit weird that it's not included in more verbose levels of collect-only. Though having the marks in an output format where each test is multiple lines makes is kinda annoying from the POV of grepping... Maybe a new flag could be added (e.g. --collect-only-include-markers)? This seems a little clunky TBH though. Ultimately if we want to consume the output of --collect-only programmatically then I think some formal structured data output makes most sense (e.g. json) but that's quite a bit more work than what I did here.
  • currently I guess this could be considered a breaking change as it changes output (but I suppose many people aren't relying on that?). I anyway included this as an improvement in the changelog for the time being.

cj-timothy-sampson avatar Jan 14 '24 09:01 cj-timothy-sampson