Skip to content

Commit 569313f

Browse files
committed
Fix TestEnv for subpackages: precompile only the new test Project
1 parent 3d198c7 commit 569313f

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

src/julia-1.11/activate_set.jl

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ function activate(pkg::AbstractString=current_pkg_name(); allow_reresolve=true)
6969
@debug "Using _clean_ dep graph"
7070
end
7171

72+
# Now that we have set up the sandbox environment, precompile all its packages:
73+
# (Reconnect the `io` back to the original context so the caller can see the
74+
# precompilation progress.)
75+
Pkg.precompile(temp_ctx; io=ctx.io)
76+
7277
write_env(temp_ctx.env; update_undo=false)
7378

7479
return Base.active_project()

src/julia-1.11/common.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function ctx_and_pkgspec(pkg::AbstractString)
2222
pkgspec = deepcopy(PackageSpec(pkg))
2323
ctx = Context()
2424
isinstalled!(ctx, pkgspec) || throw(TestEnvError("$pkg not installed 👻"))
25-
Pkg.instantiate(ctx)
25+
Pkg.instantiate(ctx; allow_autoprecomp = false) # do precomp later within sandbox
2626
return ctx, pkgspec
2727
end
2828

src/julia-1.9/activate_set.jl

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ function activate(pkg::AbstractString=current_pkg_name(); allow_reresolve=true)
6969
@debug "Using _clean_ dep graph"
7070
end
7171

72+
# Now that we have set up the sandbox environment, precompile all its packages:
73+
# (Reconnect the `io` back to the original context so the caller can see the
74+
# precompilation progress.)
75+
Pkg.precompile(temp_ctx; io=ctx.io)
76+
7277
write_env(temp_ctx.env; update_undo=false)
7378

7479
return Base.active_project()

src/julia-1.9/common.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function ctx_and_pkgspec(pkg::AbstractString)
2222
pkgspec = deepcopy(PackageSpec(pkg))
2323
ctx = Context()
2424
isinstalled!(ctx, pkgspec) || throw(TestEnvError("$pkg not installed 👻"))
25-
Pkg.instantiate(ctx)
25+
Pkg.instantiate(ctx; allow_autoprecomp = false) # do precomp later within sandbox
2626
return ctx, pkgspec
2727
end
2828

@@ -50,6 +50,7 @@ end
5050

5151
function test_dir_has_project_file(ctx, pkgspec)
5252
test_dir = get_test_dir(ctx, pkgspec)
53+
@show test_dir
5354
test_dir === nothing && return false
5455
return isfile(joinpath(test_dir, "Project.toml"))
5556
end

0 commit comments

Comments
 (0)