Skip to content

Commit

Permalink
Test suite: save the original Base.DEPOT_PATH and Base.LOAD_PATH
Browse files Browse the repository at this point in the history
…before running a test set, and restore them after running the test set
  • Loading branch information
DilumAluthge committed Sep 2, 2022
1 parent 4690323 commit f83b476
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/testdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@ function runtests(name, path, isolate=true; seed=nothing)
res_and_time_data = @timed @testset "$name" begin
# Random.seed!(nothing) will fail
seed != nothing && Random.seed!(seed)

# Save the original `Base.DEPOT_PATH` and `Base.LOAD_PATH`
original_depot_path = copy(Base.DEPOT_PATH)
original_load_path = copy(Base.LOAD_PATH)

Base.include(m, "$path.jl")

# Restore the original `Base.DEPOT_PATH` and `Base.LOAD_PATH`
empty!(Base.DEPOT_PATH)
empty!(Base.LOAD_PATH)
append!(Base.DEPOT_PATH, original_depot_path)
append!(Base.LOAD_PATH, original_load_path)

end
rss = Sys.maxrss()
#res_and_time_data[1] is the testset
Expand Down

0 comments on commit f83b476

Please sign in to comment.