I am observing a (to me) strange issue concerning code coverage. The result of Pkg.test(...; coverage=true)
tells me that a lot of methods are never called while I know they were.
The methods in question all have a very similar look (they are used to represent a property of the type) e.g.:
myfunc(::MyType) = true
calling these methods from the tests simply does not seem to count to coverage. In my desperation I tried things like using @noinline
, as well as calling the methods in tricky ways with something like:
@test myfunc(rand() <= 1 ? MyType() : 0) == true
all to no avail. According to the .cov files, myfunc
is never called.
I created a repository with a minimal example that show my confusion a little clearer hopefully. It also includes the .cov fil (tests all pass)
https://github.com/Evizero/CoverageIssue.jl
Any idea what is going on? Am I doing something wrong here?
EDIT: Also note that I think this behaviour is rather new (I discovered it today when looking at the results of Travis and Coveralls), I could immediately reproduce it locally even though I don’t remember updating anything since last it worked.
Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
System: Linux (x86_64-linux-gnu)
CPU: Intel(R) Xeon(R) CPU E5-1650 v3 @ 3.50GHz
WORD_SIZE: 64
BLAS: libopenblas (NO_LAPACK NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: liblapack.so.3
LIBM: libopenlibm
LLVM: libLLVM-3.7.1 (ORCJIT, haswell)