3434@test @nested_LINE_expansion2 () == ((@__LINE__ () - 5 , @__LINE__ () - 9 ), @__LINE__ ())
3535
3636original_depot_path = copy (Base. DEPOT_PATH )
37+ include (" tempdepot.jl" )
3738include (" precompile_utils.jl" )
3839
3940loaded_files = String[]
226227 end
227228end
228229
229-
230230# # functional testing of package identification, location & loading ##
231231
232232saved_load_path = copy (LOAD_PATH )
@@ -236,8 +236,9 @@ watcher_counter = Ref(0)
236236push! (Base. active_project_callbacks, () -> watcher_counter[] += 1 )
237237push! (Base. active_project_callbacks, () -> error (" broken" ))
238238
239+ const testdefaultdepot = mkdepottempdir ()
239240push! (empty! (LOAD_PATH ), joinpath (@__DIR__ , " project" ))
240- append! (empty! (DEPOT_PATH ), [mktempdir () , joinpath (@__DIR__ , " depot" )])
241+ append! (empty! (DEPOT_PATH ), [testdefaultdepot , joinpath (@__DIR__ , " depot" )])
241242@test watcher_counter[] == 0
242243@test_logs (:error , r" active project callback .* failed" ) Base. set_active_project (nothing )
243244@test watcher_counter[] == 1
@@ -461,7 +462,7 @@ function make_env(flat, root, roots, graph, paths, dummies)
461462 )
462463end
463464
464- const depots = [mktempdir () for _ = 1 : 3 ]
465+ const depots = [mkdepottempdir () for _ = 1 : 3 ]
465466const envs = Dict {String,Any} ()
466467
467468append! (empty! (DEPOT_PATH ), depots)
755756for env in keys (envs)
756757 rm (env, force= true , recursive= true )
757758end
758- for depot in depots
759- try
760- rm (depot, force= true , recursive= true )
761- catch err
762- @show err
763- end
764- end
765759
766760append! (empty! (LOAD_PATH ), saved_load_path)
767761append! (empty! (DEPOT_PATH ), saved_depot_path)
@@ -1043,9 +1037,10 @@ end
10431037 _pkgversion == pkgversion(parent) || error("unexpected extension \$ ext version: \$ _pkgversion")
10441038 end
10451039 """
1046- depot_path = mktempdir ()
1047- try
1048- proj = joinpath (@__DIR__ , " project" , " Extensions" , " HasDepWithExtensions.jl" )
1040+ depot_path = mkdepottempdir ()
1041+ proj = joinpath (@__DIR__ , " project" , " Extensions" , " HasDepWithExtensions.jl" )
1042+
1043+ begin
10491044
10501045 function gen_extension_cmd (compile, distr= false )
10511046 load_distr = distr ? " using Distributed; addprocs(1)" : " "
@@ -1155,7 +1150,7 @@ end
11551150
11561151 # Extension-to-extension dependencies
11571152
1158- mktempdir () do depot # Parallel pre-compilation
1153+ mkdepottempdir () do depot # Parallel pre-compilation
11591154 code = """
11601155 Base.disable_parallel_precompile = false
11611156 using ExtToExtDependency
@@ -1171,7 +1166,7 @@ end
11711166 )
11721167 @test occursin (" Hello ext-to-ext!" , String (read (cmd)))
11731168 end
1174- mktempdir () do depot # Serial pre-compilation
1169+ mkdepottempdir () do depot # Serial pre-compilation
11751170 code = """
11761171 Base.disable_parallel_precompile = true
11771172 using ExtToExtDependency
@@ -1188,7 +1183,7 @@ end
11881183 @test occursin (" Hello ext-to-ext!" , String (read (cmd)))
11891184 end
11901185
1191- mktempdir () do depot # Parallel pre-compilation
1186+ mkdepottempdir () do depot # Parallel pre-compilation
11921187 code = """
11931188 Base.disable_parallel_precompile = false
11941189 using CrossPackageExtToExtDependency
@@ -1204,7 +1199,7 @@ end
12041199 )
12051200 @test occursin (" Hello x-package ext-to-ext!" , String (read (cmd)))
12061201 end
1207- mktempdir () do depot # Serial pre-compilation
1202+ mkdepottempdir () do depot # Serial pre-compilation
12081203 code = """
12091204 Base.disable_parallel_precompile = true
12101205 using CrossPackageExtToExtDependency
@@ -1224,7 +1219,7 @@ end
12241219 # Extensions for "parent" dependencies
12251220 # (i.e. an `ExtAB` where A depends on / loads B, but B provides the extension)
12261221
1227- mktempdir () do depot # Parallel pre-compilation
1222+ mkdepottempdir () do depot # Parallel pre-compilation
12281223 code = """
12291224 Base.disable_parallel_precompile = false
12301225 using Parent
@@ -1239,7 +1234,7 @@ end
12391234 )
12401235 @test occursin (" Hello parent!" , String (read (cmd)))
12411236 end
1242- mktempdir () do depot # Serial pre-compilation
1237+ mkdepottempdir () do depot # Serial pre-compilation
12431238 code = """
12441239 Base.disable_parallel_precompile = true
12451240 using Parent
@@ -1254,13 +1249,6 @@ end
12541249 )
12551250 @test occursin (" Hello parent!" , String (read (cmd)))
12561251 end
1257-
1258- finally
1259- try
1260- rm (depot_path, force= true , recursive= true )
1261- catch err
1262- @show err
1263- end
12641252 end
12651253end
12661254
@@ -1364,7 +1352,7 @@ end
13641352end
13651353
13661354@testset " relocatable upgrades #51989" begin
1367- mktempdir () do depot
1355+ mkdepottempdir () do depot
13681356 # realpath is needed because Pkg is used for one of the precompile paths below, and Pkg calls realpath on the
13691357 # project path so the cache file slug will be different if the tempdir is given as a symlink
13701358 # (which it often is on MacOS) which would break the test.
@@ -1438,7 +1426,7 @@ end
14381426end
14391427
14401428@testset " code coverage disabled during precompilation" begin
1441- mktempdir () do depot
1429+ mkdepottempdir () do depot
14421430 cov_test_dir = joinpath (@__DIR__ , " project" , " deps" , " CovTest.jl" )
14431431 cov_cache_dir = joinpath (depot, " compiled" , " v$(VERSION . major) .$(VERSION . minor) " , " CovTest" )
14441432 function rm_cov_files ()
@@ -1482,7 +1470,7 @@ end
14821470end
14831471
14841472@testset " command-line flags" begin
1485- mktempdir () do depot_path mktempdir () do dir
1473+ mkdepottempdir () do depot_path mktempdir () do dir
14861474 # generate a Parent.jl and Child.jl package, with Parent depending on Child
14871475 open (joinpath (dir, " Child.jl" ), " w" ) do io
14881476 println (io, """
@@ -1565,7 +1553,7 @@ end
15651553end
15661554
15671555@testset " including non-existent file throws proper error #52462" begin
1568- mktempdir () do depot
1556+ mkdepottempdir () do depot
15691557 project_path = joinpath (depot, " project" )
15701558 mkpath (project_path)
15711559
@@ -1707,7 +1695,7 @@ end
17071695end
17081696
17091697@testset " require_stdlib loading duplication" begin
1710- depot_path = mktempdir ()
1698+ depot_path = mkdepottempdir ()
17111699 oldBase64 = nothing
17121700 try
17131701 push! (empty! (DEPOT_PATH ), depot_path)
@@ -1731,7 +1719,6 @@ end
17311719 finally
17321720 oldBase64 === nothing || Base. register_root_module (oldBase64)
17331721 copy! (DEPOT_PATH , original_depot_path)
1734- rm (depot_path, force= true , recursive= true )
17351722 end
17361723end
17371724
0 commit comments