diff --git a/Project.toml b/Project.toml index 7eb0381..a60bed4 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ChainRulesTestUtils" uuid = "cdddcdb0-9152-4a09-a978-84456f9df70a" -version = "1.11.0" +version = "1.12.0" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" @@ -8,6 +8,7 @@ Compat = "34da2185-b29b-5c13-b0c7-acf172513d20" FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] @@ -15,6 +16,7 @@ ChainRulesCore = "1.11.2" Compat = "3, 4" FiniteDifferences = "0.12.12" MetaTesting = "0.1" +Suppressor = "0.2.6" julia = "1" [extras] diff --git a/src/ChainRulesTestUtils.jl b/src/ChainRulesTestUtils.jl index 1226056..2d424f1 100644 --- a/src/ChainRulesTestUtils.jl +++ b/src/ChainRulesTestUtils.jl @@ -10,6 +10,7 @@ using FiniteDifferences: to_vec using LinearAlgebra using Random using Test +using Suppressor export TestIterator export test_approx, test_scalar, test_frule, test_rrule, generate_well_conditioned_matrix @@ -17,7 +18,21 @@ export ⊢, rand_tangent export @maybe_inferred export test_method_tables -__init__() = init_test_inferred_setting!() +function __init__() + init_test_inferred_setting!() + + # Try to disable backtrace scrubbing so that full failures are shown + try + isdefined(Test, :scrub_backtrace) || error("Test.scrub_backtrace not defined") + @suppress begin # mute warning about monkey-patching + # depending on julia version or one or the other of these will be hit + @eval Test scrub_backtrace(bt,) = bt # make it do nothing + @eval Test scrub_backtrace(bt, file_ts, file_t) = bt # make it do nothing + end + catch err + @warn "Failed to monkey-patch scrub_backtrace. Code is functional but stacktraces may be less useful" exception=(err, catch_backtrace()) + end +end include("global_config.jl") @@ -36,3 +51,4 @@ include("testers.jl") include("deprecated.jl") include("global_checks.jl") end # module +