Skip to content

Commit

Permalink
Quieter tests (#49093)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Mar 24, 2023
1 parent b9a334f commit 7d32099
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
9 changes: 5 additions & 4 deletions test/ambiguous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ let err = try
@test occursin("Possible fix, define\n ambig(::Integer, ::Integer)", errstr)
end

ambig_with_bounds(x, ::Int, ::T) where {T<:Integer,S} = 0
ambig_with_bounds(::Int, x, ::T) where {T<:Integer,S} = 1
@test_warn "declares type variable S but does not use it" @eval ambig_with_bounds(x, ::Int, ::T) where {T<:Integer,S} = 0
@test_warn "declares type variable S but does not use it" @eval ambig_with_bounds(::Int, x, ::T) where {T<:Integer,S} = 1
let err = try
ambig_with_bounds(1, 2, 3)
catch _e_
Expand Down Expand Up @@ -385,7 +385,7 @@ f11407(::Dict{K,V}, ::Dict{Any,V}) where {K,V} = 1
f11407(::Dict{K,V}, ::Dict{K,Any}) where {K,V} = 2
@test_throws MethodError f11407(Dict{Any,Any}(), Dict{Any,Any}()) # ambiguous
@test f11407(Dict{Any,Int}(), Dict{Any,Int}()) == 1
f11407(::Dict{Any,Any}, ::Dict{Any,Any}) where {K,V} = 3
@test_warn "declares type variable V but does not use it" @eval f11407(::Dict{Any,Any}, ::Dict{Any,Any}) where {K,V} = 3
@test f11407(Dict{Any,Any}(), Dict{Any,Any}()) == 3

# issue #12814
Expand All @@ -399,8 +399,9 @@ end

# issue #43040
module M43040
using Test
struct C end
stripType(::Type{C}) where {T} = C # where {T} is intentionally incorrect
@test_warn "declares type variable T but does not use it" @eval M43040 stripType(::Type{C}) where {T} = C # where {T} is intentionally incorrect
end

@test isempty(detect_ambiguities(M43040; recursive=true))
Expand Down
4 changes: 2 additions & 2 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5268,10 +5268,10 @@ end
GC.enable(true)

# issue #18710
bad_tvars() where {T} = 1
@test_warn "declares type variable T but does not use it" @eval bad_tvars() where {T} = 1
@test isa(which(bad_tvars, ()), Method)
@test bad_tvars() === 1
bad_tvars2() where {T} = T
@test_warn "declares type variable T but does not use it" @eval bad_tvars2() where {T} = T
@test_throws UndefVarError(:T) bad_tvars2()
missing_tvar(::T...) where {T} = T
@test_throws UndefVarError(:T) missing_tvar()
Expand Down
4 changes: 2 additions & 2 deletions test/deprecation_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ begin # @deprecate

# test that positional and keyword arguments are forwarded when
# there is no explicit type annotation
@test DeprecationTests.old_return_args(1, 2, 3) == ((1, 2, 3),(;))
@test DeprecationTests.old_return_args(1, 2, 3; a = 4, b = 5) == ((1, 2, 3), (a = 4, b = 5))
@test_logs (:warn,) @test DeprecationTests.old_return_args(1, 2, 3) == ((1, 2, 3),(;))
@test_logs (:warn,) @test DeprecationTests.old_return_args(1, 2, 3; a = 4, b = 5) == ((1, 2, 3), (a = 4, b = 5))
end

f24658() = depwarn24658()
Expand Down
2 changes: 1 addition & 1 deletion test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,7 @@ end
@test Meta.parse("import Base.Foo.:(==).bar") == :(import Base.Foo.==.bar)

# issue #33135
function f33135(x::T) where {C1, T}
@test_warn "declares type variable C1 but does not use it" @eval function f33135(x::T) where {C1, T}
let C1 = 1, C2 = 2
C1
end
Expand Down
8 changes: 6 additions & 2 deletions test/threads_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ end
# (expected test duration is about 18-180 seconds)
Timer(t -> killjob("KILLING BY THREAD TEST WATCHDOG\n"), 1200)

@testset """threads_exec.jl with JULIA_NUM_THREADS == $(ENV["JULIA_NUM_THREADS"])""" begin

@test Threads.threadid() == 1
@test 1 <= threadpoolsize() <= Threads.maxthreadid()

Expand Down Expand Up @@ -232,7 +234,7 @@ end
# Make sure that eval'ing in a different module doesn't mess up other threads
orig_curmodule14726 = @__MODULE__
main_var14726 = 1
module M14726
@eval Main module M14726
module_var14726 = 1
end

Expand All @@ -252,7 +254,7 @@ end
@test @__MODULE__() == orig_curmodule14726
end

module M14726_2
@eval Main module M14726_2
using Test
using Base.Threads
@threads for i in 1:100
Expand Down Expand Up @@ -1067,3 +1069,5 @@ end
popfirst!(LOAD_PATH)
end
end

end # main testset

2 comments on commit 7d32099

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected.
A full report can be found here.

Please sign in to comment.