-
Notifications
You must be signed in to change notification settings - Fork 25
/
test_persistent_tasks.jl
48 lines (39 loc) · 1.24 KB
/
test_persistent_tasks.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
module TestPersistentTasks
include("preamble.jl")
using Base: PkgId, UUID
using Pkg: TOML
function getid(name)
path = joinpath(@__DIR__, "pkgs", "PersistentTasks", name)
if path ∉ LOAD_PATH
pushfirst!(LOAD_PATH, path)
end
prj = TOML.parsefile(joinpath(path, "Project.toml"))
return PkgId(UUID(prj["uuid"]), prj["name"])
end
@testset "PersistentTasks" begin
@test !Aqua.has_persistent_tasks(getid("TransientTask"))
result = Aqua.find_persistent_tasks_deps(getid("TransientTask"))
@test result == []
if Base.VERSION >= v"1.10-"
@test Aqua.has_persistent_tasks(getid("PersistentTask"))
result = Aqua.find_persistent_tasks_deps(getid("UsesBoth"))
@test result == ["PersistentTask"]
end
filter!(str -> !occursin("PersistentTasks", str), LOAD_PATH)
end
@testset "test_persistent_tasks(expr)" begin
if Base.VERSION >= v"1.10-"
@test !Aqua.has_persistent_tasks(
getid("TransientTask"),
expr = quote
fetch(Threads.@spawn nothing)
end,
)
@test Aqua.has_persistent_tasks(getid("TransientTask"), expr = quote
Threads.@spawn while true
sleep(0.5)
end
end)
end
end
end