coveragepy icon indicating copy to clipboard operation
coveragepy copied to clipboard

"Jump to the function exit" in lcov report with multiline conditional

Open zackw opened this issue 4 months ago • 0 comments

This test module contains a very simple multi-line controlling expression for an if statement.

def fun(x):
    if (
        x
    ):
        print("got here")

For some reason, the way the if statement is formatted causes the arc description engine to fail to pick up the name of the function. In an LCOV report we get these branch records for line 2:

BRDA:2,0,jump to line 5,-
BRDA:2,0,jump to the function exit,-

The smallest change that makes the problem go away is to move the token x to line 2 without changing anything else, i.e.

def fun(x):
    if (x

    ):
        print("got here")

Then the branch records correctly identify the function:

BRDA:2,0,jump to line 5,-
BRDA:2,0,return from function 'fun',-

Probably related to #1874.

zackw avatar Oct 09 '24 17:10 zackw