cgarling / Cosmology.jl

Cosmological calculations in Julia
Other
0 stars 0 forks source link

try to add doctests to runtests.jl #6

Closed cgarling closed 2 years ago

codecov-commenter commented 2 years ago

Codecov Report

Merging #6 (d78a61a) into main (b3ddddf) will increase coverage by 9.28%. The diff coverage is n/a.

@@            Coverage Diff             @@
##             main       #6      +/-   ##
==========================================
+ Coverage   58.57%   67.85%   +9.28%     
==========================================
  Files           2        2              
  Lines         280      280              
==========================================
+ Hits          164      190      +26     
+ Misses        116       90      -26     
Impacted Files Coverage Δ
src/standard_functions.jl 73.07% <ø> (+11.53%) :arrow_up:
src/Cosmology.jl 58.16% <0.00%> (+5.10%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

cgarling commented 2 years ago

This PR runs our doctests as part of our runtests.jl test suite so that we can get code coverage info including the doctests without having to duplicate the doctests in runtest.jl.

We occasionally run into issues with deprecation warnings in the doctests for our z_at_value function because of Roots.jl's find_zeros function. This is inconsistent but seems to depend on whether Roots v1.4.1 or a variant of Roots v2 is installed. I have tried changing the call signature for find_zeros but have been unsuccessful at figuring out how to get rid of the warnings.

To get around this we set depwarn=no for the julia-runtest CI action which allows the doctests to pass on CI. When running the tests locally, you may have to do import Pkg; import Cosmology; Pkg.test("Cosmology";julia_args=["--depwarn=no"]) in order for the tests to pass. Strangely if I activate the test environment and include("runtests.jl") I don't get these warnings.

As part of this PR the doctests for some of the radiation density methods were changed; there was a ~1ulp change in the results between some versions of Julia, so these tests became isapprox tests rather than isequal.