re-raise coverage not noticed

Issue #63 resolved
Jonathan Lundell created an issue

OK, it's a bad title. I've got some code that contains this pattern in three places:

{{{ #!python

        s = tok
        while not s.endswith('"'):
            s += ' ' +
    except StopIteration:
        raise ElectionProfileError('bad blt item "%s" near election source; expected quoted string' % s)
    self.source = s.strip('"').strip(' ')


My test case invokes the except/raise path, but coverage (via nose, no --branch) reports the except/raise lines as uncovered. I conjecture, with no real confidence, that the issue is catching one exception and raising another, but I haven't done anything to verify that.

The full code is at ( will do a coverage report.)

Comments (3)

  1. Ned Batchelder repo owner

    I ran the test suite, and saw no evidence that those lines were executed. I added "import pdb; pdb.set_trace()" to those catch clauses, and ran nosetests with the -s switch to alllow stdout. Execution did not stop in the debugger.

    It looks like you really aren't executing that code in your tests.

  2. Jonathan Lundell reporter

    Thanks for looking. You're right: I thought that I had proved to myself (by adding a couple of other unit tests) that the path was in fact being executed. I was mistaken.

  3. Log in to comment