Skip to content

Commit

Permalink
fixup! Round timeout to whole seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
nickrobinson251 committed Dec 7, 2023
1 parent 5f1640d commit a67e21a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ macro testitem(nm, exs...)
elseif kw == :timeout
t = ex.args[2]
@assert t isa Real "`timeout` keyword must be passed a `Real`"
@assert t > 0 "`timeout` keyword must be passed a positive number. Got `timeout=$timeout`"
@assert t > 0 "`timeout` keyword must be passed a positive number. Got `timeout=$t`"
timeout = ceil(Int, t)
elseif kw == :_id
_id = ex.args[2]
Expand Down
7 changes: 4 additions & 3 deletions test/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,15 @@ end
ti = @testitem "TI" timeout=1 begin
@test true
end
@test ti.timeout isa Float64
@test ti.timeout isa Int
@test ti.timeout == 1

# We round up to the nearest second.
ti = @testitem "TI" timeout=1.1 begin
@test true
end
@test ti.timeout isa Float64
@test ti.timeout == 1.1
@test ti.timeout isa Int
@test ti.timeout == 2

ti = @testitem "TI" begin
@test true
Expand Down

0 comments on commit a67e21a

Please sign in to comment.