Skip to content

pragma no cover fails with elif #697

@artgoldberg

Description

@artgoldberg

Hi Ned, et al.,
Following https://coverage.readthedocs.io/en/coverage-4.3.4/excluding.html#branch-coverage, I expect

    def test(self):
        if False:
            pass    # 1
        elif True:  # 2
            pass
        else:    # pragma no cover
            pass    # 3
        pass # 4

to not report that branch at # 2 fails to branch to the else. This works in the above example, but in a piece of production code it reports that the branch at # 2 fails to go to #4 instead:
failed no cover

unfortunately, I don't know how to reproduce this in a minimal snippet.

thanks
Arthur

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcpythonReported as a bug in CPythonnot our bugThe problem was elsewhere

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions