Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML report fails with 'int' object is unsubscriptable #59

nedbat opened this issue Apr 8, 2010 · 2 comments

HTML report fails with 'int' object is unsubscriptable #59

nedbat opened this issue Apr 8, 2010 · 2 comments
bug Something isn't working


Copy link

nedbat commented Apr 8, 2010

Hi all,

Running coverage html, I'm running into this exception:


Traceback (most recent call last):
 File "/srv/bb-master/.local/bin/coverage", line 8, in <module>
   load_entry_point('coverage==3.3.1', 'console_scripts', 'coverage')()
 File "/srv/bb-master/.local/lib/python2.5/site- packages/coverage-3.3.1-py2.5-linux-i686.egg/coverage/", line 601, in main
   status = CoverageScript().command_line(argv)
 File "/srv/bb-master/.local/lib/python2.5/site- packages/coverage-3.3.1-py2.5-linux-i686.egg/coverage/", line 507, in command_line, **report_args)
 File "/srv/bb-master/.local/lib/python2.5/site- packages/coverage-3.3.1-py2.5-linux-i686.egg/coverage/", line 362, in html_report
 File "/srv/bb-master/.local/lib/python2.5/site- packages/coverage-3.3.1-py2.5-linux-i686.egg/coverage/", line 48, in report
 File "/srv/bb-master/.local/lib/python2.5/site- packages/coverage-3.3.1-py2.5-linux-i686.egg/coverage/", line 153, in index_file
 File "/srv/bb-master/.local/lib/python2.5/site- packages/coverage-3.3.1-py2.5-linux-i686.egg/coverage/", line 103, in render
 File "/srv/bb-master/.local/lib/python2.5/site- packages/coverage-3.3.1-py2.5-linux-i686.egg/coverage/", line 129, in execute
   raise new_exc
TypeError: Couldn't evaluate {{ totals.pc_covered|format_pct }}: 'int' object is unsubscriptable

Anyone know what's wrong?


Copy link
Owner Author

nedbat commented Apr 8, 2010

Original comment by Jean-Paul Calderone (Bitbucket: exarkun, GitHub: exarkun)

Attached is a .coverage file with which I can reproduce this issue. It was generated on an Ubuntu Hardy machine by generating coverage for Twisted. In a Twisted trunk@28817 checkout, this command was run:

coverage run ./bin/trial --reporter=bwverbose twisted

Coverage 3.3.1 was used (installed from source, as that version is not packaged for Hardy AFAICT), along with Python 2.5.2 (Hardy packaged version). The resulting file was then transferred to another Ubuntu Hardy machine and an html report generated using this command:

coverage html -d twisted-coverage --omit /usr,/srv/bb-slave/.local,/srv/bb-slave/Projects,/srv/bb-slave/Run/slave/ -i

As you might guess from the omit arguments, the Twisted checkout was in /srv/bb-slave/Run/slave/

The second machine also had Coverage 3.3.1 installed, as well as Python 2.5.2 (Hardy packaged version).

Copy link
Owner Author

nedbat commented Jun 4, 2010

This is because for whatever reason, your HTML report has no files in it. You must be over-constraining the report, or not measuring any data at all somehow.

In <<changeset 99a25749a8d2 (bb)>>, I fixed to return a nice exception ("No data to report") rather than trip over itself with subscripted ints.

@nedbat nedbat closed this as completed Jun 4, 2010
@nedbat nedbat added major bug Something isn't working labels Jun 23, 2018
agronholm pushed a commit to agronholm/coveragepy that referenced this issue Aug 16, 2020
Check all parents for cancellation, not just the immediate one.

Fixes nedbat#58.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
bug Something isn't working
None yet

No branches or pull requests

1 participant