From a21da3e4e9cce1bf060e1c93e68e7b9214cdcdf3 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Tue, 23 Jul 2024 09:58:14 -0500 Subject: [PATCH 1/2] Drop deprecations --- src/Mocking.jl | 1 - src/deprecated.jl | 45 --------------------------------------------- test/activate.jl | 29 ----------------------------- test/runtests.jl | 1 - 4 files changed, 76 deletions(-) delete mode 100644 src/deprecated.jl delete mode 100644 test/activate.jl diff --git a/src/Mocking.jl b/src/Mocking.jl index f7fc684..9e72368 100644 --- a/src/Mocking.jl +++ b/src/Mocking.jl @@ -17,7 +17,6 @@ include("dispatch.jl") include("debug.jl") include("patch.jl") include("mock.jl") -include("deprecated.jl") # Create the initial definition of `activated` which defaults having Mocking be deactivated. # We utilize method invalidation as a feature here to allow functions using `@mock` to be diff --git a/src/deprecated.jl b/src/deprecated.jl deleted file mode 100644 index 95508f0..0000000 --- a/src/deprecated.jl +++ /dev/null @@ -1,45 +0,0 @@ -using Base: depwarn - -function ismocked(pe::PatchEnv, func_name::Symbol, args::Tuple) - m = @__MODULE__ - depwarn("`$m.ismocked` is no longer used and can be safely removed.", :ismocked) - return false -end - -# Note: The `depwarn` call here is similar to using `@deprecate` but instead shows a fully -# qualified function name. -function enable(; force=false) - m = @__MODULE__ - depwarn( - "`$m.enable(; force=$force)` is deprecated, use `$m.activate()` instead.", - :enable, - # format trick: using this comment to force use of multiple lines - ) - return activate() -end - -function activate(f) - m = @__MODULE__ - depwarn("`$m.activate(f)` is deprecated and will be removed in the future.", :activate) - - started_deactivated = !activated() - try - activate() - Base.invokelatest(f) - finally - started_deactivated && deactivate() - end -end - -function deactivate() - m = @__MODULE__ - depwarn( - "`$m.deactivate()` is deprecated and will be removed in the future.", - :deactivate, - # format trick: using this comment to force use of multiple lines - ) - - # Avoid redefining `_activated` when it's already set appropriately - Base.invokelatest(activated) && @eval _activated(::Int) = false - return nothing -end diff --git a/test/activate.jl b/test/activate.jl deleted file mode 100644 index ed35919..0000000 --- a/test/activate.jl +++ /dev/null @@ -1,29 +0,0 @@ -@testset "activate(func)" begin - add1(x) = x + 1 - patch = @patch add1(x) = x + 42 - - # Starting with Mocking enabled. - Mocking.activate() - @test Mocking.activated() - @test_deprecated Mocking.activate() do - apply(patch) do - @test (@mock add1(2)) == 44 - end - end - @test Mocking.activated() - - # Starting with Mocking disabled. - # Make sure to leave it enabled for the rest of the tests. - try - @test_deprecated Mocking.deactivate() - @test !Mocking.activated() - @test_deprecated Mocking.activate() do - apply(patch) do - @test (@mock add1(2)) == 44 - end - end - @test !Mocking.activated() - finally - Mocking.activate() - end -end diff --git a/test/runtests.jl b/test/runtests.jl index f90d909..1e98a93 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -38,6 +38,5 @@ Mocking.activate() include("nested_apply.jl") include("async-scope.jl") include("issues.jl") - include("activate.jl") include("async-world-ages.jl") end From 402d4c891cff17b2d6786df182489129c3b5b0d6 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Tue, 23 Jul 2024 09:59:03 -0500 Subject: [PATCH 2/2] Set project version to 0.8.0 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 2226080..97b07f9 100644 --- a/Project.toml +++ b/Project.toml @@ -4,7 +4,7 @@ keywords = ["testing", "mocking"] license = "MIT" desc = "Allows Julia function calls to be temporarily overloaded for purpose of testing" author = ["Curtis Vogt"] -version = "0.7.9" +version = "0.8.0" [deps] Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"