Skip to content

Commit d83ec0e

Browse files
committed
Skip tests that require delete_method on older julia versions
1 parent f92873d commit d83ec0e

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

test/global_checks.jl

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,33 @@ struct BadConstructor
22
x
33
end
44

5-
@testset "global_checks.jl" begin
6-
test_method_tables_sensibility()
5+
if VERSION >= v"1.3"
6+
@testset "global_checks.jl" begin
7+
test_method_tables_sensibility()
8+
ChainRulesCore.rrule(::typeof(BadConstructor), x) = nothing
9+
@test fails(test_method_tables_sensibility)
10+
Base.delete_method(Base.which(rrule, (DataType, Any)))
11+
test_method_tables_sensibility() # make sure delete worked
712

8-
ChainRulesCore.rrule(::typeof(BadConstructor), x) = nothing
9-
@test fails(test_method_tables_sensibility)
10-
Base.delete_method(Base.which(Tuple{typeof(rrule), DataType, Any}))
11-
test_method_tables_sensibility() # make sure delete worked
13+
ChainRulesCore.rrule(::RuleConfig, ::typeof(BadConstructor), x) = nothing
14+
@test fails(test_method_tables_sensibility)
15+
Base.delete_method(Base.which(rrule, (RuleConfig, DataType, Any)))
16+
test_method_tables_sensibility() # make sure delete worked
1217

13-
ChainRulesCore.rrule(::RuleConfig, ::typeof(BadConstructor), x) = nothing
14-
@test fails(test_method_tables_sensibility)
15-
Base.delete_method(Base.which(Tuple{typeof(rrule), RuleConfig, DataType, Any}))
16-
test_method_tables_sensibility() # make sure delete worked
1718

1819

20+
ChainRulesCore.frule(::Any, ::typeof(BadConstructor), x) = nothing
21+
@test fails(test_method_tables_sensibility)
22+
Base.delete_method(Base.which(frule, (Any, DataType, Any)))
23+
test_method_tables_sensibility() # make sure delete worked
1924

20-
ChainRulesCore.frule(::Any, ::typeof(BadConstructor), x) = nothing
21-
@test fails(test_method_tables_sensibility)
22-
Base.delete_method(Base.which(Tuple{typeof(frule), Any, DataType, Any}))
23-
test_method_tables_sensibility() # make sure delete worked
24-
25-
ChainRulesCore.frule(::RuleConfig, ::Any, ::typeof(BadConstructor), x) = nothing
26-
@test fails(test_method_tables_sensibility)
27-
Base.delete_method(Base.which(Tuple{typeof(frule), RuleConfig, Any, DataType, Any}))
28-
test_method_tables_sensibility() # make sure delete worked
25+
ChainRulesCore.frule(::RuleConfig, ::Any, ::typeof(BadConstructor), x) = nothing
26+
@test fails(test_method_tables_sensibility)
27+
Base.delete_method(Base.which(frule, (RuleConfig, Any, DataType, Any)))
28+
test_method_tables_sensibility() # make sure delete worked
29+
end
30+
else # pre 1.3, so no `delete_method` so just test happy path
31+
@testset "global_checks.jl" begin
32+
test_method_tables_sensibility()
33+
end
2934
end

0 commit comments

Comments
 (0)