numirias / pytest-json-report

🗒️ A pytest plugin to report test results as JSON
MIT License
147 stars 39 forks source link

remove useless no-report-written test summary output #64

Closed jurko-gospodnetic closed 3 years ago

jurko-gospodnetic commented 3 years ago

In case user requests that there is no JSON report file actually written (and instead all the collected report information is just kept stored in the plugin object - typical scenario when doing customized reporting), there is no need to add extra:

---------------------- JSON report ----------------------
no JSON report written.

filler content to the end of the pytest terminal output.

numirias commented 3 years ago

The idea is to convey whether the plugin has been doing any work. Even if no outfile is written, I wanted to give some indication that the plugin has been busy compiling a report object. I didn't want there to be a scenario where the plugin slows down a test suite by generating large reports in memory without informing the user who thus assumes it's been idle.

For that, I agree the message isn't very useful, so what do you think about changing it along the lines of JSON report generated (not written to file) or JSON report generated in memory?

(Thanks for your previous well-written PRs.)

jurko-gospodnetic commented 3 years ago

hmm, I'm coming at this from a place where:

so I know we have JSON report running and do not need extra information in the output just to tell me 'yes, you used the JSON report plugin;

if you feel that such output is really useful in other scenarios, would it be ok if we add some option to make JSON report be 'less verbose' and not output such filler summary output?

numirias commented 3 years ago

I tied the summary output verbosity to pytest's default --verbosity. This may already work the way you need it, but you can also use the new --json-report-verbosity=LEVEL to force a level, e.g. -1 to suppress all terminal output by the plugin.

I hope this works for you!

Edit: Didn't mean to close without merge. Merged as 5ad1b7d99b2de9417c25420b7ff5e9d3ef21bdd0, 29182fb24bb41572d01dd108a09506d147266a61.

jurko-gospodnetic commented 3 years ago

thanks, works nicely for us; added one more test case in https://github.com/numirias/pytest-json-report/pull/68