assert line in analysis.missing
since coverage 7.6.2 · Issue #1896 · nedbat/coveragepy (original) (raw)
Describe the bug
Running python -m coverage lcov -o coverage.lcov
used to work just fine until coverage 7.6.1:
$ python -m coverage --version
Coverage.py, version 7.6.1 with C extension
Full documentation is at https://coverage.readthedocs.io/en/7.6.1
$ python -m coverage lcov -o coverage.lcov
Wrote LCOV report to coverage.lcov
This doesn't work since 7.6,2:
$ pip install coverage==7.6.7
$ python -m coverage lcov -o coverage.lcov
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/path/to/project/.venv/lib64/python3.12/site-packages/coverage/__main__.py", line 10, in <module>
sys.exit(main())
^^^^^^
File "/path/to/project/.venv/lib64/python3.12/site-packages/coverage/cmdline.py", line 970, in main
status = CoverageScript().command_line(argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/project/.venv/lib64/python3.12/site-packages/coverage/cmdline.py", line 743, in command_line
total = self.coverage.lcov_report(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/project/.venv/lib64/python3.12/site-packages/coverage/control.py", line 1277, in lcov_report
return render_report(self.config.lcov_output, LcovReporter(self), morfs, self._message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/project/.venv/lib64/python3.12/site-packages/coverage/report_core.py", line 62, in render_report
ret = reporter.report(morfs, outfile=outfile)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/project/.venv/lib64/python3.12/site-packages/coverage/lcovreport.py", line 189, in report
self.lcov_file(fname, fr, analysis, outfile)
File "/path/to/project/.venv/lib64/python3.12/site-packages/coverage/lcovreport.py", line 221, in lcov_file
lcov_arcs(fr, analysis, lines, outfile)
File "/path/to/project/.venv/lib64/python3.12/site-packages/coverage/lcovreport.py", line 124, in lcov_arcs
assert line in analysis.missing
^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
To Reproduce
How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:
- What version of Python are you using?
Python 3.9, 3.10, 3.11, and 3.12.
- What version of coverage.py shows the problem? The output of
coverage debug sys
is helpful.
Since coverage 7.6.2 up to the latest 7.6.7.
- What versions of what packages do you have installed? The output of
pip freeze
is helpful.
absl-py==2.1.0
backports-datetime-fromisoformat==1.0.0
black==24.10.0
cffi==1.15.0
click==8.1.7
contourpy==1.3.1
coverage==7.6.7
cycler==0.12.1
dataclasses-json==0.6.7
et_xmlfile==2.0.0
fonttools==4.55.0
grenml==1.0.0
immutabledict==4.2.1
iniconfig==2.0.0
isort==5.13.2
kiwisolver==1.4.7
lxml==4.9.4
marshmallow==3.23.1
matplotlib==3.9.2
mip==1.14.2
mypy-extensions==1.0.0
networkx==3.4.2
numpy==2.1.3
openpyxl==3.1.5
ortools==9.11.4210
packaging==24.2
pandas==2.2.3
pathspec==0.12.1
pillow==11.0.0
platformdirs==4.3.6
pluggy==1.5.0
protobuf==5.26.1
prtpy==0.8.3
pycparser==2.22
pydot==3.0.2
pyparsing==3.2.0
pytest==8.3.3
pytest-cov==6.0.0
pytest-sugar==1.0.0
python-dateutil==2.9.0.post0
pytz==2024.2
ruff==0.0.285
scipy==1.14.1
sdx-datamodel @ git+https://github.com/atlanticwave-sdx/datamodel@d9ac85a9fdd1c87aedc56001859fc5fe543b365a
-e git+https://github.com/atlanticwave-sdx/pce@eb64f3f93fe90e16a5da80b75ce44de0e9f4f6ff#egg=sdx_pce
six==1.16.0
termcolor==2.5.0
typing-inspect==0.9.0
typing_extensions==4.12.2
tzdata==2024.2
- 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.
I am trying to send coverage report in LCOV format to coveralls.io from https://github.com/atlanticwave-sdx/pce (please excuse the prototype-iness), and running python -m coverage lcov -o coverage.lcov
from CI jobs fails with a backtrace, as described above. This is reproducible in a local setup also. This library uses a dependency with a C extension (ortools), and I suspect that could be the problem, because other "pure" Python projects I work on are not affected.
Using coverage 7.6.1 is the workaround.
- 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!
Do this (assuming bash and Linux):
$ git clone https://github.com/atlanticwave-sdx/pce
$ cd pce
$ python3.12 -m venv .venv --upgrade-deps
$ source .venv/bin/activate
$ pip install tox
$ tox
$ python -m coverage lcov -o coverage.lcov
Expected behavior
Coverage should be able to produce an LCOV file without crashing.
Additional context
Unsure, sorry!