Mocking.jl
Mocking.jl copied to clipboard
uses ScopedValues to fix async issue
In julia 1.11 we get a proper way to do what ContextVariablesX did with an hack.
This is a rebasing of #91 with that switch over it should not run into the issues that required #93
julia> f() = "original"
f (generic function with 1 method)
julia> p = @patch f() = "mocked"
Patch{typeof(f)}(f, var"##f_patch#233")
julia> apply(p) do
@show Mocking.PATCH_ENV[]
end;
Mocking.PATCH_ENV[] = Mocking.PatchEnv(Dict{Any, Vector{Function}}(f => [var"##f_patch#233"]), false)
Going to kick start the CI workflow
The change here broke the test case on Julia 1.11+ which was testing for issue #108. I'll roll this change back temporarily and include it in a breaking release.