coverage with tox
See original GitHub issueI followed your youtube video as a guide in this repository and I put this in my pyproject.toml:
[tool.pytest.ini_options]
addopts = "--cov=src/be8bbbce/components --cov-branch"
testpaths = [
"tests",
]
When I run pytest
, I see my statement and branch coverage the way I want, but when I run tox
, it says I have 0% statement coverage and doesn’t show any branch coverage.
How do I get tox
to show the same coverage as pytest
?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Tox — pytest-cov 4.0.0 documentation - Read the Docs
An usual problem users have is that pytest-cov will erase the previous coverage data by default, thus if you run tox with multiple...
Read more >Testing better with coverage and tox
coverage. This tool tells you what parts of your code are actually getting executed by the test suite. It can't guarantee that you're...
Read more >Making py.test, coverage and tox work together: __init__.py in ...
I'm having a weird problem with tox , py.test , coverage and pytest-cov : when py.test with the --cov option is launched from...
Read more >Platform Dependent Python Coverage Test with Tox
When testing Python programs, coverage.py is often used in measuring code coverage, and enforcing 100% code coverage is regarded as a good ...
Read more >tox + coverage : getting combined python code ... - gists · GitHub
tox + coverage : getting combined python code coverage. - 1_tox.ini. ... [tox]. envlist = begin,py{26,27,33},end. [testenv]. deps=coverage. commands =.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @pyrkamarcin I think either one of those solutions works great depending on what you want. @beauxq I think that should solve your issue so I’ll go ahead and close this.
I figured it out when I remembered 7:59 in the youtube video.
Because I was trying to get coverage on only 1 submodule of my package, I was giving it a directory of where to look:
--cov=src/be8bbbce/components
But it’s not running code in that directory. It’s running a link in …
lib/python/site-packages
I think I tried
--cov=be8bbbce/components
at some point and found it didn’t work, but after I remembered it’s running the installed package, I tried--cov=be8bbbce.components
and it worked.