JuliaTesting / Aqua.jl

Auto QUality Assurance for Julia packages
MIT License
334 stars 24 forks source link

test_persistent_tasks: Add an optional `expr` to run in the precompile package #255

Closed NHDaly closed 9 months ago

NHDaly commented 9 months ago

(From this slack discussion)

Here's an example of it working!

julia> Aqua.test_persistent_tasks(MuttsDicts, quote
           Threads.@spawn while true sleep(0.5) end
       end)
...

Precompiling project...
        Info Given jl_qFKXwPShk5 was explicitly requested, output will be shown live

[pid 21955] waiting for IO to finish:
 TYPE[FD/PID]       @UV_HANDLE_T->DATA
 timer              @0x600001585d00->0x10afffac0
  Activating project at `~/work/raicode3`            ]  0/1
Test Failed at /Users/nathandaly/work/jl_depots/raicode3/dev/Aqua/src/persistent_tasks.jl:98
  Expression: !(has_persistent_tasks(package, expr; kwargs...))

ERROR: There was an error during testing
codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (28d29dc) 75.20% compared to head (a112dd5) 75.20%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #255 +/- ## ======================================= Coverage 75.20% 75.20% ======================================= Files 11 11 Lines 750 750 ======================================= Hits 564 564 Misses 186 186 ``` | [Flag](https://app.codecov.io/gh/JuliaTesting/Aqua.jl/pull/255/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaTesting) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/JuliaTesting/Aqua.jl/pull/255/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaTesting) | `75.20% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaTesting#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

lgoettgens commented 9 months ago

I see where this is coming from and how this can be useful. Some comment from the first look: I would prefer expr to be a kwarg. In Aqua, we usually use kwargs for everything apart from the Package to test. Furthermore, there are merge conflicts with https://github.com/JuliaTesting/Aqua.jl/pull/256 and https://github.com/JuliaTesting/Aqua.jl/pull/250. Could you have a look at those? I think most should be due to the docstring being mostly moved to a docs page.

NHDaly commented 9 months ago

Okay! Thanks @lgoettgens.

I rebased on master, fixed the merge conflicts, added a test case, and changed expr to a keyword argument.

The reason I had made it a positional argument at first was because I wasn't sure what a good name should be. Is expr okay? Should it be precompile_expr?

lgoettgens commented 9 months ago

The reason I had made it a positional argument at first was because I wasn't sure what a good name should be. Is expr okay? Should it be precompile_expr?

I have no real preference between the two.

NHDaly commented 9 months ago

Thanks! Should be all done then