Describe the bug
I want to combine coverage data from pytest runs performed on Linux and on Windows.
I execute them with the pytest-cov plugin and can report the coverage for each platform individually, but if I use coverage combine on Linux to combine the coverage databases to get the common code coverage, it reports:
No source for code: 'src\<module>\__init__.py'
If you look closely you can see that the path contains backslashes, which are from the Windows run and this path obviously doesn't exist on the Linux system, where the code coverage data should be combined and a report generated.
It seems coverage.py stores paths in the native way of the platform, which I confirmed by analyzing the database files:
.coverage.windows the table file contains:
.coverage.linux the table file contains:
To Reproduce
- Execute a code coverage run on Linux and Windows platforms from the root of a cross-platform Python module
- Try to merge the coverage using
coverage combine ...
Answer the questions below:
- What version of Python are you using?
- What version of coverage.py shows the problem? The output of
coverage debug sys is helpful.
- What versions of what packages do you have installed? The output of
pip freeze is helpful.
- What code shows the problem? Give us a specific commit of a specific repo that we can check out. If you've already worked around the problem, please provide a commit before that fix.
- What commands should we run to reproduce the problem? Be specific. Include everything, even
git clone, pip install, and so on. Explain like we're five!
Expected behavior
I expect coverage combine to be able to combine code coverage data from different platforms. It should be able to normalize the paths to the current platform, so that coverage html and coverage xml can work on the combined data.
Additional context
It might make sense to use pathlib to store coverage data in Posix format in the database and convert on Windows if needed.
Describe the bug
I want to combine coverage data from pytest runs performed on Linux and on Windows.
I execute them with the
pytest-covplugin and can report the coverage for each platform individually, but if I usecoverage combineon Linux to combine the coverage databases to get the common code coverage, it reports:If you look closely you can see that the path contains backslashes, which are from the Windows run and this path obviously doesn't exist on the Linux system, where the code coverage data should be combined and a report generated.
It seems coverage.py stores paths in the native way of the platform, which I confirmed by analyzing the database files:
.coverage.windowsthe tablefilecontains:.coverage.linuxthe tablefilecontains:To Reproduce
coverage combine ...Answer the questions below:
coverage debug sysis helpful.coverage==7.15.2pip freezeis helpful.git clone,pip install, and so on. Explain like we're five!Expected behavior
I expect
coverage combineto be able to combine code coverage data from different platforms. It should be able to normalize the paths to the current platform, so thatcoverage htmlandcoverage xmlcan work on the combined data.Additional context
It might make sense to use
pathlibto store coverage data in Posix format in the database and convert on Windows if needed.