CleanCut / green

Green is a clean, colorful, fast python test runner.
MIT License
791 stars 75 forks source link

Feature: Don't output coverage results after generating coverage results. #131

Closed lsh-0 closed 7 years ago

lsh-0 commented 8 years ago

It doesn't look like the coverage support in green picks up coverage's .coveragerc file for configuration.

If all of coverage's options were supported on the command line, or if green didn't print the coverage report afterwards this wouldn't be an issue.

CleanCut commented 8 years ago

if green didn't print the coverage report afterwards

Green doesn't print the coverage report afterwards unless you ask it to. You have to specify -r or --run-coverage

What do you see happening in your environment?

lsh-0 commented 8 years ago

When I run green without --run-coverage, the .coverage results file is not created.

When I run green with --run-coverage, the .coverage results file is created, but the report is also printed. The report doesn't appear to obey the configuration in the .coveragerc file.

lsh-0 commented 8 years ago

Python 2.7.12, green==2.5.0 and coverage==4.1 if it helps.

CleanCut commented 8 years ago

Okay, I see what you are saying. I think there is simply some confusion regarding the --run-coverage option. That option causes green itself to enable coverage on tests that it runs and then green itself prints it the results by calling into coverage's output code. So that's actually part of the feature in green, which is why .coveragerc doesn't affect it -- green is calling the coverage output itself. The rest of coverage's behaviour should be affected by .coveragerc, since that's up to coverage's independent behavior.

We could certainly make a green output option to not print coverage results, even if it were run. That would simply be a new feature, though.

lsh-0 commented 8 years ago

Perhaps, have --run-coverage to run coverage, and --coverage-report to display the coverage report? Up to you. I can see how displaying the coverage report automatically would be convenient to a lot of people, it just becomes inconvenient when I want to go one step further.

My usecase is that I'm extracting the coverage percentage from the report and ensuring coverage is above a certain value, else I fail the test run. My rc file excludes certain files from the coverage report that affects the percentage coverage.

althonos commented 7 years ago

@CleanCut: I just realized this is a duplicate of #148 (which I forgot to check before creating a new issue). I guess you could close it

@lsh-0: check out the version 2.6.0, it integrates the PR in which I added this feature.

lsh-0 commented 7 years ago

looks promising, cheers @althonos

CleanCut commented 7 years ago

Closing duplicate of #148