Skip to content

Commit 21937b7

Browse files
authoredMar 14, 2025··
Merge pull request #95 from JuliaTesting/kc/binding
use invokelatest to check for binding existance after evaling a package load
2 parents b652737 + 980220c commit 21937b7

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed
 

‎test/activate_do.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
TestEnv.activate("ChainRulesCore") do
1717
@eval using FiniteDifferences
1818
end
19-
@test isdefined(@__MODULE__, :FiniteDifferences)
19+
@test Base.invokelatest(isdefined, @__MODULE__, :FiniteDifferences)
2020

2121
# We use endswith here because on MacOS GitHub runners for some reasons the paths are slightly different
2222
# We also skip on Julia 1.2 and 1.3 on Windows because it is using 8 character shortened paths in one case
@@ -44,7 +44,7 @@
4444
TestEnv.activate("MCMCDiagnosticTools"; kw...) do
4545
@eval using FFTW
4646
end
47-
@test isdefined(@__MODULE__, :FFTW)
47+
@test Base.invokelatest(isdefined, @__MODULE__, :FFTW)
4848

4949
@test endswith(Base.active_project(), orig_project)
5050
elseif VERSION >= v"1.2-"
@@ -56,7 +56,7 @@
5656
TestEnv.activate("ConstraintSolver") do
5757
@eval using Combinatorics
5858
end
59-
@test isdefined(@__MODULE__, :Combinatorics)
59+
@test Base.invokelatest(isdefined, @__MODULE__, :Combinatorics)
6060

6161
# We use endswith here because on MacOS GitHub runners for some reasons the paths are slightly different
6262
# We also skip on Windows because it is using 8 character shortened paths in one case

‎test/activate_set.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
@test orig_load_path == Base.LOAD_PATH
1515

1616
@eval using StaticArrays # From ChainRulesCore [extras] Project.toml
17-
@test isdefined(@__MODULE__, :StaticArrays)
17+
@test Base.invokelatest(isdefined, @__MODULE__, :StaticArrays)
1818

1919
@eval using Compat # from ChainRulesCore Project.toml
20-
@test isdefined(@__MODULE__, :StaticArrays)
20+
@test Base.invokelatest(isdefined, @__MODULE__, :Compat)
2121
finally
2222
Pkg.activate(orig_project_toml_path)
2323
# No longer is enviroment active
@@ -49,7 +49,7 @@
4949
@test orig_load_path == Base.LOAD_PATH
5050

5151
@eval using CSV
52-
@test isdefined(@__MODULE__, :CSV)
52+
@test Base.invokelatest(isdefined, @__MODULE__, :CSV)
5353

5454
finally
5555
Pkg.activate(orig_project_toml_path)
@@ -73,7 +73,7 @@
7373
@test orig_load_path == Base.LOAD_PATH
7474

7575
@eval using JSON
76-
@test isdefined(@__MODULE__, :JSON)
76+
@test Base.invokelatest(isdefined, @__MODULE__, :JSON)
7777

7878
finally
7979
Pkg.activate(orig_project_toml_path)

0 commit comments

Comments
 (0)
Please sign in to comment.