|
90 | 90 | end |
91 | 91 | end |
92 | 92 |
|
| 93 | + if VERSION >= v"1.4-" |
| 94 | + # https://github.com/JuliaTesting/TestEnv.jl/pull/120 |
| 95 | + # A package whose `test/Manifest.toml` dev's the package itself, i.e. what |
| 96 | + # `julia --project=test -e 'using Pkg; Pkg.develop(path=".")'` produces. |
| 97 | + @testset "activate package dev'ed in its own test/Manifest" begin |
| 98 | + mktempdir() do p |
| 99 | + pkg_path = joinpath(p, "SelfDevTestManifest") |
| 100 | + cp(joinpath(@__DIR__, "sources", "SelfDevTestManifest"), pkg_path) |
| 101 | + |
| 102 | + orig_project_toml_path = Base.active_project() |
| 103 | + orig_load_path = copy(LOAD_PATH) |
| 104 | + push!(LOAD_PATH, mktempdir()) # put something weird in LOAD_PATH for testing |
| 105 | + try |
| 106 | + # Generate the test/Manifest.toml that dev's the package itself |
| 107 | + Pkg.activate(joinpath(pkg_path, "test")) |
| 108 | + Pkg.develop(PackageSpec(path=pkg_path)) |
| 109 | + |
| 110 | + # ... and the package's own manifest |
| 111 | + Pkg.activate(pkg_path) |
| 112 | + Pkg.resolve() |
| 113 | + |
| 114 | + TestEnv.activate() |
| 115 | + new_project_toml_path = Base.active_project() |
| 116 | + @test new_project_toml_path != orig_project_toml_path |
| 117 | + |
| 118 | + @eval using SelfDevTestManifest |
| 119 | + @test Base.invokelatest(isdefined, @__MODULE__, :SelfDevTestManifest) |
| 120 | + @test (@eval SelfDevTestManifest.foo()) == 42 |
| 121 | + finally |
| 122 | + Pkg.activate(orig_project_toml_path) |
| 123 | + pop!(LOAD_PATH) |
| 124 | + @test orig_load_path == LOAD_PATH |
| 125 | + end |
| 126 | + end |
| 127 | + end |
| 128 | + end |
| 129 | + |
93 | 130 | if VERSION >= v"1.11" |
94 | 131 | @testset "activate with [sources]" begin |
95 | 132 | orig_project_toml_path = Base.active_project() |
|
0 commit comments