Skip to content

Commit

Permalink
Hide message about changed ENV when test is ignored (#50883)
Browse files Browse the repository at this point in the history
PR #47148 added the ability to ignore changes to the environment in a
testsuite (using the `JULIA_TEST_CHECK_MUTATED_ENV` environment
variable), but didn't hide the printing of the error message. This hides
the actual error message so that the terminal isn't cluttered with them
when they should be ignored. This is needed because in the MKL.jl
testsuite, the error is hit for basically every linear algebra test
(JuliaLinearAlgebra/MKL.jl#130), and so even
when we have already disabled the error, printing the error message
causes lots of noise on the terminal that can possibly hide other
problems.

Co-authored-by: Dilum Aluthge <[email protected]>
  • Loading branch information
imciner2 and DilumAluthge authored Aug 21, 2023
1 parent ead627e commit 9a820e6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/testdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ function runtests(name, path, isolate=true; seed=nothing)
error(msg)
end
if copy(ENV) != original_env
msg = "The `$(name)` test set mutated ENV and did not restore the original values"
@error(
msg,
testset_name = name,
testset_path = path,
)
throw_error_str = get(ENV, "JULIA_TEST_CHECK_MUTATED_ENV", "true")
throw_error_b = parse(Bool, throw_error_str)
if throw_error_b
msg = "The `$(name)` test set mutated ENV and did not restore the original values"
@error(
msg,
testset_name = name,
testset_path = path,
)
error(msg)
end
end
Expand Down

0 comments on commit 9a820e6

Please sign in to comment.