Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Aqua tests and fix ambiguities #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
Printf = "1"
RecipesBase = "1.0"
Statistics = "1"
julia = "^1.3"
4 changes: 2 additions & 2 deletions src/logqpool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ end
Creates a task that runs `fn(args...)` and adds it to the pool, blocking
until the pool has an available thread.
"""
Base.put!(pool::LoggedQueuePool, fn, args...) = Base.put!(pool, Task(()->fn(args...)))
Base.put!(fn, pool::LoggedQueuePool, args...) = Base.put!(pool, Task(()->fn(args...)))
Base.put!(pool::LoggedQueuePool, fn::T, args...) where {T <: Function} = Base.put!(pool, Task(()->fn(args...)))
Base.put!(fn::T, pool::LoggedQueuePool, args...) where {T <: Function} = Base.put!(pool, Task(()->fn(args...)))


"""
Expand Down
6 changes: 3 additions & 3 deletions src/logs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ object, or a filename to be opened and read. `dt` is the time step
for each row, `t0` is the optional starting time, `t1` the optional stopping
time, and `nthreads` is the number of threads to print.
"""
function showactivity(io, log::ThreadLog, dt, t0=0, t1=Inf; nthreads=0)
function showactivity(io::IO, log::ThreadLog, dt, t0=0, t1=Inf; nthreads=0)
maxj = maximum(j.id for jobs in values(log) for j in jobs)
width = length(string(maxj)) + 3

Expand All @@ -188,10 +188,10 @@ function showactivity(io, log::ThreadLog, dt, t0=0, t1=Inf; nthreads=0)
end
end

showactivity(io, fname::String, dt, t0=0, t1=Inf; nthreads=0) = showactivity(io, readlog(fname), dt, t0, t1; nthreads=nthreads)
showactivity(io::IO, fname::String, dt, t0=0, t1=Inf; nthreads=0) = showactivity(io, readlog(fname), dt, t0, t1; nthreads=nthreads)
showactivity(log::ThreadLog, dt, t0=0, t1=Inf; nthreads=0) = showactivity(Base.stdout, log, dt, t0, t1; nthreads=nthreads)
showactivity(fname::String, dt, t0=0, t1=Inf; nthreads=0) = showactivity(Base.stdout, readlog(fname), dt, t0, t1; nthreads=nthreads)
showactivity(io, pool::AbstractThreadPool, dt, t0=0, t1=Inf; nthreads=0) = showactivity(io, pool.log, dt, t0, t1; nthreads=nthreads)
showactivity(io::IO, pool::AbstractThreadPool, dt, t0=0, t1=Inf; nthreads=0) = showactivity(io, pool.log, dt, t0, t1; nthreads=nthreads)
showactivity(pool::AbstractThreadPool, dt, t0=0, t1=Inf; nthreads=0) = showactivity(Base.stdout, pool.log, dt, t0, t1; nthreads=nthreads)


Expand Down
4 changes: 2 additions & 2 deletions src/qpool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ end
Creates a task that runs `fn(args...)` and adds it to the pool, blocking
until the pool has an available thread.
"""
Base.put!(pool::QueuePool, fn, args...) = Base.put!(pool, Task(()->fn(args...)))
Base.put!(fn, pool::QueuePool, args...) = Base.put!(pool, Task(()->fn(args...)))
Base.put!(pool::QueuePool, fn::T, args...) where {T <: Function} = Base.put!(pool, Task(()->fn(args...)))
Base.put!(fn::T, pool::QueuePool, args...) where {T <: Function} = Base.put!(pool, Task(()->fn(args...)))


"""
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Expand Down
1 change: 1 addition & 0 deletions test/runtests_exec.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Test, ThreadPools
include("testaqua.jl")
include("teststatic.jl")
include("testlogstatic.jl")
include("testq.jl")
Expand Down
12 changes: 12 additions & 0 deletions test/testaqua.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module TestAqua

using Test
using ThreadPools
using Aqua


@testset "Aqua" begin
Aqua.test_all(ThreadPools)
end

end # module