From cf4ab8336468f73bbc768187864586bedbd59342 Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Thu, 30 Jan 2025 16:15:48 -0500 Subject: [PATCH] REPL: fix test that fails locally via `Pkg.test` (#57202) Via `Base.runtests` it seems stdlibs are generally available in test environments. In `Pkg.test` they must be in the test env, which Profile isn't, so this failed locally. All REPL tests pass locally with this. --- stdlib/REPL/test/docview.jl | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/stdlib/REPL/test/docview.jl b/stdlib/REPL/test/docview.jl index c81715ad69921..8c92d9b3b1d95 100644 --- a/stdlib/REPL/test/docview.jl +++ b/stdlib/REPL/test/docview.jl @@ -29,8 +29,22 @@ end end @testset "non-loaded packages in doc search" begin - str = get_help_io("Profile") - @test occursin("Couldn't find Profile, but a loadable package with that name exists.", str) + temp_package = mktempdir() + write(joinpath(temp_package, "Project.toml"), + """ + name = "FooPackage" + uuid = "2e6e0b2d-0e7f-4b7f-9f3b-6f3f3f3f3f3f" + """) + mkpath(joinpath(temp_package, "src")) + write(joinpath(temp_package, "src", "FooPackage.jl"), + """ + module FooPackage + end + """) + push!(LOAD_PATH, temp_package) + str = get_help_io("FooPackage") + @test occursin("Couldn't find FooPackage, but a loadable package with that name exists.", str) + @test pop!(LOAD_PATH) == temp_package end @testset "Check @var_str also completes to var\"\" in REPL.doc_completions()" begin