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 Base.depwarn() exclusively, and fix deprecation tests #4333

Merged
merged 2 commits into from
Sep 18, 2024
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
18 changes: 13 additions & 5 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
###########################################
# v0.20 deprecations:
##
Base.@deprecate_binding DiscreteSurface CellGrid true
Base.@deprecate_binding ContinuousSurface VertexGrid true

function DiscreteSurface(args...; kwargs...)
@warn "Makie.DiscreteSurface() is deprecated, use Makie.CellGrid() instead" maxlog=1
CellGrid(args...; kwargs...)

Check warning on line 7 in src/deprecated.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecated.jl#L5-L7

Added lines #L5 - L7 were not covered by tests
end

function ContinuousSurface(args...; kwargs...)
@warn "Makie.ContinuousSurface() is deprecated, use Makie.VertexGrid() instead" maxlog=1
VertexGrid(args...; kwargs...)

Check warning on line 12 in src/deprecated.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecated.jl#L10-L12

Added lines #L10 - L12 were not covered by tests
end

function Base.getproperty(scene::Scene, field::Symbol)
if field === :px_area
Expand All @@ -14,7 +22,7 @@

@deprecate pixelarea viewport true

function Combined(args...)
Base.depwarn("Makie.Combined(args...) is deprecated, use Makie.Plot(args...) instead")
Plot(args...)
function Combined(args...; kwargs...)
@warn "Makie.Combined() is deprecated, use Makie.Plot() instead" maxlog=1
Plot(args...; kwargs...)

Check warning on line 27 in src/deprecated.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecated.jl#L25-L27

Added lines #L25 - L27 were not covered by tests
end
19 changes: 8 additions & 11 deletions test/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ macro depwarn_message(expr)
$(esc(expr))
end
if length(logger.logs) == 1
return logger.logs[1].message
logger.logs[1].message
else
return nothing
nothing
end
end
end
Expand All @@ -34,17 +34,14 @@ end
end
@testset "Plot -> Combined" begin
logger = Test.TestLogger()
msg = @depwarn_message Combined
@test occursin("Combined is deprecated", msg)
@test Combined == Plot
msg = @depwarn_message Makie.Combined()
@test occursin("Combined() is deprecated", msg)
end
@testset "Surface Traits" begin
@test DiscreteSurface == CellGrid
@test ContinuousSurface == VertexGrid
msg = @depwarn_message DiscreteSurface()
@test occursin("DiscreteSurface is deprecated", msg)
msg = @depwarn_message ContinuousSurface()
@test occursin("ContinuousSurface is deprecated", msg)
msg = @depwarn_message Makie.DiscreteSurface()
@test occursin("DiscreteSurface() is deprecated", msg)
msg = @depwarn_message Makie.ContinuousSurface()
@test occursin("ContinuousSurface() is deprecated", msg)
end
@testset "AbstractVector ImageLike" begin
msg = @depwarn_message image(1:10, 1..10, zeros(10, 10))
Expand Down
Loading