html reporting fails on Python 3.2 and 2.7

Issue #76 resolved
Brett Cannon created an issue

I am trying to use to test importlib (a pure Python implementation of import in Python 3.1). I would love to have html output to more easily see what is not being executed, but every time I try to generate html code, I get an error (ignore the runpy stuff; modified to run with the -m flag so that I could easily run in-place in my svn checkout of Python): {{{ #!python

File "/Users/brett/Dev/python/3.x/importlib_abc_fixes/Lib/", line 160, in _run_module_as_main "main", fname, loader, pkg_name) File "/Users/brett/Dev/python/3.x/importlib_abc_fixes/Lib/", line 73, in _run_code exec(code, run_globals) File "/Users/brett/Dev/python/3.x/importlib_abc_fixes/coverage/", line 3, in <module> cmdline.main() File "coverage/", line 601, in main status = CoverageScript().command_line(argv) File "coverage/", line 507, in command_line, **report_args) File "coverage/", line 362, in html_report omit_prefixes=self.config.omit_prefixes File "coverage/", line 45, in report self.report_files(self.html_file, morfs, directory, omit_prefixes) File "coverage/", line 57, in report_files report_fn(cu, self.coverage._analyze(cu)) File "coverage/", line 67, in html_file missing_branch_arcs = analysis.missing_branch_arcs() File "coverage/", line 112, in missing_branch_arcs missing = self.arcs_missing() File "coverage/", line 78, in arcs_missing possible = self.arc_possibilities() File "coverage/", line 67, in arc_possibilities return self.parser.arcs() File "coverage/", line 58, in _wrapped setattr(self, attr, fn(self)) File "coverage/", line 200, in arcs for l1, l2 in self.byte_parser._all_arcs(): File "coverage/", line 586, in _all_arcs arcs.update(bp._arcs()) File "coverage/", line 505, in _arcs chunks = self._split_into_chunks() File "coverage/", line 443, in _split_into_chunks block_stack.pop() IndexError: pop from empty list


My best guess is that does not like the fact that some test files get imported that do not exist at html creation time since they were temporary (or never actually existed in the first place; I use fake file paths for files that are never created). This is not preventing the normal report output from working; it's only affecting the html output.

Comments (6)

  1. Ned Batchelder repo owner

    Brett, I've never seen an error like this. Do you have a tarball I can try myself? I can add -m support to while we're at it...

  2. Former user Account Deleted

    I'm seeing a problem that seems to match up with the ticket summary, but I don't get the same traceback as Brett reported. Instead, I see this error:

    No source for code: '/tmp/ (macro)>': [Errno 2] No such file or directory: '/tmp/ (macro)>'

    Which seems to stop `coverage html ...`. The resulting htmlcov directory doesn't have an index or the css file.

  3. Ned Batchelder repo owner

    Anonymous: use the -i switch on the html command, or send me a reproducible case. Your filename has "(macro) >" in it, which is odd, what produces that? Also, giving me a way to get in touch with you would also help.

  4. Log in to comment