JuliaTesting / ReferenceTests.jl

Utility package for comparing data against reference files
https://juliatesting.github.io/ReferenceTests.jl/latest/
Other
82 stars 14 forks source link

Incompatible with latest FileIO and AbstractPlotting #86

Closed Octogonapus closed 3 years ago

Octogonapus commented 3 years ago

This seems to be a similar issue to https://github.com/JuliaPlots/GLMakie.jl/pull/164

I am using Julia 1.5.3, ReferenceTests v0.9.5, FileIO v1.6.4, and GLMakie v0.1.30.

This code:

using ReferenceTests
using GLMakie
@test_reference "plot.png" scatter(1:4)

results in this exception:

ERROR: MethodError: save(::FileIO.File{FileIO.DataFormat{:PNG},String}, ::AbstractPlotting.FigureAxisPlot) is ambiguous. Candidates:
  save(file::FileIO.Formatted, args...; options...) in FileIO at /home/salmon/.julia/packages/FileIO/BUPwf/src/loadsave.jl:131
  save(filename, fig::Union{Figure, AbstractPlotting.FigureAxisPlot, Scene}; resolution, pt_per_unit, px_per_unit) in AbstractPlotting at /home/salmon/.julia/packages/AbstractPlotting/l5lsp/src/display.jl:227
Possible fix, define
  save(::FileIO.Formatted, ::Union{Figure, AbstractPlotting.FigureAxisPlot, Scene})
Stacktrace:
 [1] savefile(::FileIO.File{FileIO.DataFormat{:PNG},String}, ::AbstractPlotting.FigureAxisPlot) at /home/salmon/.julia/packages/ReferenceTests/zU5IN/src/fileio.jl:20
 [2] (::ReferenceTests.var"#10#11"{AbstractPlotting.FigureAxisPlot})(::String) at /home/salmon/.julia/packages/ReferenceTests/zU5IN/src/fileio.jl:71
 [3] mktempdir(::ReferenceTests.var"#10#11"{AbstractPlotting.FigureAxisPlot}, ::String; prefix::String) at ./file.jl:709
 [4] mktempdir(::Function, ::String) at ./file.jl:707 (repeats 2 times)
 [5] _convert(::Type{FileIO.DataFormat{:PNG}}, ::AbstractPlotting.FigureAxisPlot) at /home/salmon/.julia/packages/ReferenceTests/zU5IN/src/fileio.jl:69
 [6] test_reference(::FileIO.File{FileIO.DataFormat{:PNG},String}, ::AbstractPlotting.FigureAxisPlot, ::Nothing, ::Nothing; kw::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/salmon/.julia/packages/ReferenceTests/zU5IN/src/test_reference.jl:103
 [7] test_reference(::FileIO.File{FileIO.DataFormat{:PNG},String}, ::AbstractPlotting.FigureAxisPlot, ::Nothing, ::Nothing) at /home/salmon/.julia/packages/ReferenceTests/zU5IN/src/test_reference.jl:100
 [8] test_reference(::String, ::AbstractPlotting.FigureAxisPlot; by::Nothing, render::Nothing, kw::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/salmon/.julia/packages/ReferenceTests/zU5IN/src/test_reference.jl:90
 [9] test_reference(::String, ::AbstractPlotting.FigureAxisPlot) at /home/salmon/.julia/packages/ReferenceTests/zU5IN/src/test_reference.jl:90
 [10] top-level scope at REPL[3]:1
oxinabox commented 3 years ago

I think this is a problem that need to be solved by AbstractPlotting, right @SimonDanisch? I think it needs to define the save(::FileIO.Formatted, ::Union{Figure, AbstractPlotting.FigureAxisPlot, Scene})

This ambiguity only uses AbstractPlotting types, and types/functions from one of its depenencies: FileIO. I think one can generate this ambiguity just with AbstactPlotting. It would be useful to make a MWE and open issue there, linking back to this one

Octogonapus commented 3 years ago

Closed by https://github.com/JuliaPlots/AbstractPlotting.jl/pull/664