Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use invokelatest to check for binding existance after evaling a package load #95

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/activate_do.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
TestEnv.activate("ChainRulesCore") do
@eval using FiniteDifferences
end
@test isdefined(@__MODULE__, :FiniteDifferences)
@test Base.invokelatest(isdefined, @__MODULE__, :FiniteDifferences)

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

@test endswith(Base.active_project(), orig_project)
elseif VERSION >= v"1.2-"
Expand All @@ -56,7 +56,7 @@
TestEnv.activate("ConstraintSolver") do
@eval using Combinatorics
end
@test isdefined(@__MODULE__, :Combinatorics)
@test Base.invokelatest(isdefined, @__MODULE__, :Combinatorics)

# We use endswith here because on MacOS GitHub runners for some reasons the paths are slightly different
# We also skip on Windows because it is using 8 character shortened paths in one case
Expand Down
8 changes: 4 additions & 4 deletions test/activate_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
@test orig_load_path == Base.LOAD_PATH

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

@eval using Compat # from ChainRulesCore Project.toml
@test isdefined(@__MODULE__, :StaticArrays)
@test Base.invokelatest(isdefined, @__MODULE__, :Compat)
finally
Pkg.activate(orig_project_toml_path)
# No longer is enviroment active
Expand Down Expand Up @@ -49,7 +49,7 @@
@test orig_load_path == Base.LOAD_PATH

@eval using CSV
@test isdefined(@__MODULE__, :CSV)
@test Base.invokelatest(isdefined, @__MODULE__, :CSV)

finally
Pkg.activate(orig_project_toml_path)
Expand All @@ -73,7 +73,7 @@
@test orig_load_path == Base.LOAD_PATH

@eval using JSON
@test isdefined(@__MODULE__, :JSON)
@test Base.invokelatest(isdefined, @__MODULE__, :JSON)

finally
Pkg.activate(orig_project_toml_path)
Expand Down
Loading