Skip to content

Commit 5c294de

Browse files
authored
tests: remove extraneous REPL and Pkg dependencies (#59694)
We do not need these anymore to test Base functions, since kind souls have moved the relevant functions to Base.
1 parent 39e1473 commit 5c294de

File tree

4 files changed

+31
-25
lines changed

4 files changed

+31
-25
lines changed

test/gcext/gcext-test.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# tests the output of the embedding example is correct
44
using Test
5-
using Pkg
65

76
if Sys.iswindows()
87
# libjulia needs to be in the same directory as the embedding executable or in path

test/loading.jl

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,34 +1368,42 @@ end
13681368
# realpath is needed because Pkg is used for one of the precompile paths below, and Pkg calls realpath on the
13691369
# project path so the cache file slug will be different if the tempdir is given as a symlink
13701370
# (which it often is on MacOS) which would break the test.
1371-
project_path = joinpath(realpath(depot), "project")
1372-
mkpath(project_path)
13731371

13741372
# Create fake `Foo.jl` package with two files:
13751373
foo_path = joinpath(depot, "dev", "Foo51989")
13761374
mkpath(joinpath(foo_path, "src"))
1377-
open(joinpath(foo_path, "src", "Foo51989.jl"); write=true) do io
1378-
println(io, """
1375+
write(joinpath(foo_path, "src", "Foo51989.jl"),
1376+
"""
13791377
module Foo51989
13801378
include("internal.jl")
13811379
end
13821380
""")
1383-
end
1384-
open(joinpath(foo_path, "src", "internal.jl"); write=true) do io
1385-
println(io, "const a = \"asd\"")
1386-
end
1387-
open(joinpath(foo_path, "Project.toml"); write=true) do io
1388-
println(io, """
1381+
write(joinpath(foo_path, "src", "internal.jl"),
1382+
"const a = \"asd\"")
1383+
write(joinpath(foo_path, "Project.toml"),
1384+
"""
13891385
name = "Foo51989"
13901386
uuid = "00000000-0000-0000-0000-000000000001"
13911387
version = "1.0.0"
13921388
""")
1393-
end
1389+
write(joinpath(foo_path, "Manifest.toml"),
1390+
"""
1391+
# This file is machine-generated - editing it directly is not advised
1392+
julia_version = "1.13.0-DEV"
1393+
manifest_format = "2.0"
1394+
project_hash = "8699765aeeac181c3e5ddbaeb9371968e1f84d6b"
13941395
1395-
# In our depot, `dev` and then `precompile` this `Foo` package.
1396-
@test success(addenv(
1397-
`$(Base.julia_cmd()) --project=$project_path --startup-file=no -e 'import Pkg; Pkg.develop("Foo51989"); Pkg.precompile(); exit(0)'`,
1398-
"JULIA_DEPOT_PATH" => depot))
1396+
[[deps.Foo51989]]
1397+
path = "."
1398+
uuid = "00000000-0000-0000-0000-000000000001"
1399+
version = "1.0.0"
1400+
""")
1401+
1402+
# In our depot, `precompile` this `Foo` package.
1403+
@test success(pipeline(addenv(
1404+
`$(Base.julia_cmd()) --project=$foo_path --startup-file=no -e 'Base.Precompilation.precompilepkgs(["Foo51989"]); exit(0)'`,
1405+
"JULIA_DEPOT_PATH" => depot,
1406+
); stdout, stderr))
13991407

14001408
# Get the size of the generated `.ji` file so that we can ensure that it gets altered
14011409
foo_compiled_path = joinpath(depot, "compiled", "v$(VERSION.major).$(VERSION.minor)", "Foo51989")
@@ -1413,10 +1421,10 @@ end
14131421
end
14141422

14151423
# Try to load `Foo`; this should trigger recompilation, not an error!
1416-
@test success(addenv(
1417-
`$(Base.julia_cmd()) --project=$project_path --startup-file=no -e 'using Foo51989; exit(0)'`,
1424+
@test success(pipeline(addenv(
1425+
`$(Base.julia_cmd()) --project=$foo_path --startup-file=no -e 'using Foo51989; exit(0)'`,
14181426
"JULIA_DEPOT_PATH" => depot,
1419-
))
1427+
); stdout, stderr))
14201428

14211429
# Ensure that there is still only one `.ji` file (it got replaced
14221430
# and the file size changed).

test/runtests.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
using Test
44
using Distributed
55
using Dates
6-
if !Sys.iswindows() && isa(stdin, Base.TTY)
7-
import REPL
8-
end
96
using Printf: @sprintf
107
using Base: Experimental
118
using Base.ScopedValues
@@ -239,9 +236,9 @@ cd(@__DIR__) do
239236
if !Sys.iswindows() && isa(stdin, Base.TTY)
240237
t = current_task()
241238
stdin_monitor = @async begin
242-
term = REPL.Terminals.TTYTerminal("xterm", stdin, stdout, stderr)
239+
term = Base.Terminals.TTYTerminal("xterm", stdin, stdout, stderr)
243240
try
244-
REPL.Terminals.raw!(term, true)
241+
Base.Terminals.raw!(term, true)
245242
while true
246243
c = read(term, Char)
247244
if c == '\x3'
@@ -258,7 +255,7 @@ cd(@__DIR__) do
258255
catch e
259256
isa(e, InterruptException) || rethrow()
260257
finally
261-
REPL.Terminals.raw!(term, false)
258+
Base.Terminals.raw!(term, false)
262259
end
263260
end
264261
end

test/stdlib_dependencies.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This file is a part of Julia. License is MIT: https://julialang.org/license
2+
13
using Libdl
24
using Pkg
35
using Test

0 commit comments

Comments
 (0)