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
Describe the bug
Currently we are using bazel coverage to get the coverage report with Bazel. We have all the tests passed but the coverage report will show this error. (Bazel coverage is using coveragepy to generate coverage report)
Converting coveragepy database to lcov: /private/var/tmp/_bazel_nlou/b43af9baf9d056244183c6c3d6dd8487/sandbox/darwin-sandbox/6/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/_coverage/common_tools_test/test/pylcov.dat
Wrote LCOV report to /private/var/tmp/_bazel_nlou/b43af9baf9d056244183c6c3d6dd8487/sandbox/darwin-sandbox/6/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/_coverage/common_tools_test/test/pylcov.dat
Traceback (most recent call last):
File "/private/var/tmp/_bazel_nlou/b43af9baf9d056244183c6c3d6dd8487/sandbox/darwin-sandbox/6/execroot/__main__/bazel-out/darwin-fastbuild/bin/common_tools_test.runfiles/python311_x86_64-apple-darwin_coverage/coverage/__main__.py", line 8, in <module>
sys.exit(main())
^^^^^^
File "/private/var/tmp/_bazel_nlou/b43af9baf9d056244183c6c3d6dd8487/sandbox/darwin-sandbox/6/execroot/__main__/bazel-out/darwin-fastbuild/bin/common_tools_test.runfiles/python311_x86_64-apple-darwin_coverage/coverage/cmdline.py", line 944, in main
status = CoverageScript().command_line(argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/tmp/_bazel_nlou/b43af9baf9d056244183c6c3d6dd8487/sandbox/darwin-sandbox/6/execroot/__main__/bazel-out/darwin-fastbuild/bin/common_tools_test.runfiles/python311_x86_64-apple-darwin_coverage/coverage/cmdline.py", line 720, in command_line
total = self.coverage.lcov_report(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/tmp/_bazel_nlou/b43af9baf9d056244183c6c3d6dd8487/sandbox/darwin-sandbox/6/execroot/__main__/bazel-out/darwin-fastbuild/bin/common_tools_test.runfiles/python311_x86_64-apple-darwin_coverage/coverage/control.py", line 1102, in lcov_report
return render_report(self.config.lcov_output, LcovReporter(self), morfs, self._message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/tmp/_bazel_nlou/b43af9baf9d056244183c6c3d6dd8487/sandbox/darwin-sandbox/6/execroot/__main__/bazel-out/darwin-fastbuild/bin/common_tools_test.runfiles/python311_x86_64-apple-darwin_coverage/coverage/report.py", line 35, in render_report
return reporter.report(morfs, outfile=outfile)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/tmp/_bazel_nlou/b43af9baf9d056244183c6c3d6dd8487/sandbox/darwin-sandbox/6/execroot/__main__/bazel-out/darwin-fastbuild/bin/common_tools_test.runfiles/python311_x86_64-apple-darwin_coverage/coverage/lcovreport.py", line 34, in report
self.get_lcov(fr, analysis, outfile)
File "/private/var/tmp/_bazel_nlou/b43af9baf9d056244183c6c3d6dd8487/sandbox/darwin-sandbox/6/execroot/__main__/bazel-out/darwin-fastbuild/bin/common_tools_test.runfiles/python311_x86_64-apple-darwin_coverage/coverage/lcovreport.py", line 57, in get_lcov
line = source_lines[covered-1].encode("utf-8")
~~~~~~~~~~~~^^^^^^^^^^^
IndexError: list index out of range
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.16
What version of coverage.py shows the problem? The output of coverage debug sys is helpful.
nlou9
changed the title
coverage report is not able to generate because of the IndexError: list index out of range
coverage report failed to generate due to the IndexError: list index out of range
May 8, 2023
check the code coverage file. It seems it is also checking the tmpdir pytest created for the test. This might be the reason which causes the error. How to avoid this?
Describe the bug
Currently we are using
bazel coverage
to get the coverage report with Bazel. We have all the tests passed but the coverage report will show this error. (Bazel coverage is using coveragepy to generate coverage report)To Reproduce
How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:
python 3.9.16
coverage debug sys
is helpful.pip freeze
is helpful.The text was updated successfully, but these errors were encountered: