JuliaCI / JuliaCI/Coverage.jl

Lower coverage in Julia v1.11

Open
#346 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
182
Forks
67
PR merge metrics
No merged PRs in 30d

Description

In Julia v1.10.6, the code below gets 100% coverage. In Julia v1.11.1, foo is not marked as covered.

src/Example.jl:

module Example

export foo, bar

function foo(x) end       # covered in v1.10 but not covered in v1.11
function bar(x; o=1) end  # covered in both versions

end

test/runtests.jl:

using Example, Test

@test isnothing(foo(1))
@test isnothing(bar(1))

I understand that this package uses a workaround to mark lines as code that then may not be marked as covered. Indeed, with DISABLE_AMEND_COVERAGE_FROM_SRC=yes, I get full coverage in v1.11.

Based on that, I presume the explanation here is that the compiler optimizes foo out, while bar has a default parameter and somehow gets tracked anyway.

But I am surprised to see this change when switching between Julia versions. My questions are:

  • Is this intended behavior?
  • Is there a way to get full coverage back in v1.11 without setting the environment variable?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example from src/Example.jl and test/runtests.jl on Julia 1.10.6 and 1.11.1, including a run with DISABLE_AMEND_COVERAGE_FROM_SRC=yes. Read the Coverage.jl workaround documentation and the coverage-amendment path to determine whether the change is expected. Done means documenting the behavior and an evidence-backed supported way to restore full coverage, if one exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.