You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been struggling with CoverageWarning: No data was collected. in a src layout project.
It boiled down to the tool incorrectly discovering the layout of my project.
Reproducer
# clone this repo v5.0.0
git clone --depth 1 --branch v5.0.0 git@github.com:pytest-dev/pytest-cov.git
cd pytest-cov
# create a venv with tox installed
python -m venv venv
source venv/bin/activate
pip install tox
cd examples/src-layout/
# run tox and notice how the report contains coverage of `src/example/__init__.py`
tox
# now create an empty folder that looks like it could be the package under test and run tox again# this time, you'll notice that coverage data for coverage of `src/example/__init__.py` is missing
mkdir example
tox
I'm suspecting that's because the tool is thinking the folder example might contain the package while in reality src/example does. But I'm not 100% sure on this.
You might be wondering if this behavior is even a problem and why on earth I ended up having a folder with the name of my library in the root while using a src layout. It's surprisingly easy to end up in this situation when using git. The library I've been working on used to have an ad-hoc layout and still has on the LTS branch. However, it's using the src layout on the dev branch. Now git doesn't care about empty folders. So when you check out the LTS branch and then the dev branch, you're left with this really hard to debug situation 😇
The text was updated successfully, but these errors were encountered:
Summary
I've been struggling with
CoverageWarning: No data was collected.
in a src layout project.It boiled down to the tool incorrectly discovering the layout of my project.
Reproducer
I'm suspecting that's because the tool is thinking the folder
example
might contain the package while in realitysrc/example
does. But I'm not 100% sure on this.You might be wondering if this behavior is even a problem and why on earth I ended up having a folder with the name of my library in the root while using a src layout. It's surprisingly easy to end up in this situation when using
git
. The library I've been working on used to have an ad-hoc layout and still has on the LTS branch. However, it's using the src layout on the dev branch. Nowgit
doesn't care about empty folders. So when you check out the LTS branch and then the dev branch, you're left with this really hard to debug situation 😇The text was updated successfully, but these errors were encountered: