-
-
Notifications
You must be signed in to change notification settings - Fork 445
run command does not respect the --omit flag #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
First, thanks for the great reproducible test case! Here's the output I got:
Here's what's happening: test_module/contrib/init.py was never run. Because you specified source=test_module, when the execution was done, coverage.py searched the tree for unexecuted files, and found that file, and marked it as unexecuted in the results. BUG: the search for unexecuted files should take the "omit" setting into account, and not add them as unexecuted if they are omitted. I fiddled with the test case some, and added some more cases. I made test_module/contrib/init.py actually execute, and I added a run with no --source setting. I got this:
Notice in the first case (no omit), the file is marked as 100%. In the second case (omit), it's marked as 0%! Keep in mind, the file is fully run. In this second case, it's because the actual execution is ignored because of the omit, but then the file is found during the search for unexecuted files, and added in as unexecuted. In the third case (omit, but no source), the file is completed left out of the report, as you'd expect. Thanks for the report, and sorry for the delay in digging into it! |
I'd like to fix this in the next release. |
Here's the modified test case I used. |
Fixed in changeset 4e67741540e2 (bb). |
Originally reported by Jonathan Suever (Bitbucket: suever, GitHub: suever)
When running coverage and specifying a source directory, if you would like to omit a submodule using the --omit flag, it is ignored by run.
If you add the omit definition to a configuration file under the [run] section, it appears that it respects it, however, it doesn't actually it's just that both REPORT and HTML read the omit definition of the [run] part of the configuration file.
If you remove the configuration file, then don't actually run coverage again, but rather just generate a report, you can see that the "omitted" folder was still processed.
I have attached an example module along with a bash script for demonstrating the issue (reproduce.sh). In this example, I am attempting to ignore test_module/contrib.
The text was updated successfully, but these errors were encountered: