Skip to content

testdefs: make sure that if a test set changes the active project, they change it back when they're done #51029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/testdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function runtests(name, path, isolate=true; seed=nothing)
original_depot_path = copy(Base.DEPOT_PATH)
original_load_path = copy(Base.LOAD_PATH)
original_env = copy(ENV)
original_project = Base.active_project()

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

Expand Down Expand Up @@ -63,6 +64,17 @@ function runtests(name, path, isolate=true; seed=nothing)
error(msg)
end
end
if Base.active_project() != original_project
msg = "The `$(name)` test set changed the active project and did not restore the original value"
@error(
msg,
original_project,
Base.active_project(),
testset_name = name,
testset_path = path,
)
error(msg)
end
end
rss = Sys.maxrss()
#res_and_time_data[1] is the testset
Expand Down