From 8e12a07f3becd45b4512e476086b16a866bc8d95 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Sun, 4 Sep 2022 16:42:53 -0400 Subject: [PATCH] Test suite: restore the original `ENV` at the end of the test suite --- test/runtests.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 0f2157b959..77b2373ea2 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,6 +4,7 @@ module PkgTestsOuter original_depot_path = copy(Base.DEPOT_PATH) original_load_path = copy(Base.LOAD_PATH) +original_env = copy(ENV) module PkgTestsInner @@ -83,4 +84,11 @@ empty!(Base.LOAD_PATH) append!(Base.DEPOT_PATH, original_depot_path) append!(Base.LOAD_PATH, original_load_path) +for k in setdiff(collect(keys(ENV)), collect(keys(original_env))) + delete!(ENV, k) +end +for (k, v) in pairs(original_env) + ENV[k] = v +end + end # module