Unexpected Results for Code Coverage with Julia Tests

Hi,

I’ve written a bunch of unit tests for my Julia package that are run by a GitHub action and uploaded to codecov.io.
However, lines marked as “uncovered” seem to be wrong at a few spots.

Especially, when macros are called form within macros they are not detected as “covered”.

Here is a minimal example:

macro some_macro(x)
    quote
        y = $(esc(x))
        if y <= 0
           @call_leq_zero y
        else
           @call_geq_zero y
        end
    end
end

If I run @some_macro from within a unit test, the lines @call_leq_zero and @call_geq_zero are not marked as covered.

Does anyone have experienced the same or know why this problem occurs?

Thanks!
Best,
Jannes

I haven’t looked into your specific example, but there’s lots of known issues regarding code coverage. Currently it’s just not very reliable. Github issues labeled as code coverage.

Yeah, I decided to just live with the 97% coverage that I get without covering the macros…
I hope this will be solved in the future

1 Like