I hope it's not terribly rude to reopen this, but I believe this is still extant, and I have a reliable reproduction for you. Let me know if you want me to instead open a separate issue. This is causing us pain when asserting coverage in our namespaced package.
Repro: (should be able to copy-paste the whole block)
(BTW: is there a way to get py.test to not use terminal-width punctuation?) This is on OS X, I had the same results on Ubuntu. Are these results also a problem?
Not sure about the terminal width question but the issue is that I expect asottile/yaml/__init__'s coverage to be nonzero. It is certainly imported in tests/yaml_test so should at least get "coverage" on the import statements and function definitions.
If you pipe py.test to cat, it will correctly revert to non-terminal-aware mode:
I ran my reproduction steps afresh and still got the same output. I'm on Ubuntu Saucy. I don't have a Mac machine handy at the moment to try out.
At any rate, you have reproduced the problem to some extent; the correct coverage measure for asottile/yaml/__init__ is 100%.
Here's what I know: the asottile/yaml/init.py file is getting installed into the .tox virtualenv, and being run from there. The .coveragerc file has an omit rule that omits all the files installed into the .tox virtualenv. Therefore, no lines in asottile/yaml/init.py are being covered.
I don't know if this has to do with namespace packages. It's odd to install your code under test into the .tox virtualenv, for just this reason.
Ned: that's actually a core feature of tox. It ensures that the tests run in the same relationship to the code as our users: after installing. It means that if we forget to include a module or package in our setup.py, tests won't pass.
We'll edit our coveragerc and report back.
Maybe this was a false alarm :(
Is there any way to tell coverage to give me the absolute paths?
I suspect the local and installed code are getting mixed up.
I used the debug feature to see what files were being traced or not, and why: [run] debug=trace
Yep, coverage is doing exactly what we told it to.