Skip to content

Commit 03cbe1f

Browse files
committed
move preference installation to later
1 parent cb4000a commit 03cbe1f

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

test/artifacts.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ import Pkg.Artifacts: pack_platform!, unpack_platform, with_artifacts_directory,
66
using TOML, Dates
77
import Base: SHA1
88

9+
# Order-dependence in the tests, so we delay this until we need it
10+
if Base.find_package("Preferences") === nothing
11+
@info "Installing Preferences for Pkg tests"
12+
Pkg.add("Preferences") # Needed for sandbox and artifacts tests
13+
end
14+
using Preferences
15+
916
using ..Utils
1017

1118
# Helper function to create an artifact, then chmod() the whole thing to 0o644. This is
@@ -310,7 +317,6 @@ end
310317
end
311318
end
312319

313-
using Preferences
314320
@testset "Artifact Usage" begin
315321
# Don't use `temp_pkg_dir()` here because we need `Pkg.test()` to run in the
316322
# same package context as the one we're running in right now. Yes, this pollutes

test/runtests.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ Pkg.REPLMode.minirepl[] = Pkg.REPLMode.MiniREPL() # re-set this given DEFAULT_IO
2828

2929
include("utils.jl")
3030

31-
if Base.find_package("Preferences") === nothing
32-
Pkg.add("Preferences") # Needed for sandbox and artifacts tests
33-
end
34-
3531
Logging.with_logger(hide_logs ? Logging.NullLogger() : Logging.current_logger()) do
3632
@testset "Pkg" begin
3733
@testset "$f" for f in [

test/sandbox.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
module SandboxTests
22
import ..Pkg # ensure we are using the correct Pkg
33

4+
# Order-dependence in the tests, so we delay this until we need it
5+
if Base.find_package("Preferences") === nothing
6+
@info "Installing Preferences for Pkg tests"
7+
Pkg.add("Preferences") # Needed for sandbox and artifacts tests
8+
end
9+
410
using Test
511
using UUIDs
612
using Pkg

0 commit comments

Comments
 (0)