From de13d400aa62e5364204f3cfa3816a6488421e31 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Sun, 8 Sep 2019 21:33:56 +0200 Subject: [PATCH] remove PlotReferenceImages dependency --- Project.toml | 7 +++---- src/Plots.jl | 2 +- test/imgcomp.jl | 1 - test/runtests.jl | 26 ++++++++++++++++++++++++-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index 53a14f2d..33523f66 100644 --- a/Project.toml +++ b/Project.toml @@ -45,14 +45,13 @@ Gtk = "4c0ca9eb-093a-5379-98c5-f87ac0bbbf44" ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1" Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0" LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -PlotReferenceImages = "c5e800db-1e6b-5f72-915a-308d267b7a19" -RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b" +LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b" StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228" VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92" [targets] -test = ["Pkg", "Test", "Random", "StatsPlots", "VisualRegressionTests", "LaTeXStrings", "Images", "ImageMagick", "RDatasets", "FileIO", "Gtk", "UnicodePlots", "PlotReferenceImages"] +test = ["FileIO", "Gtk", "ImageMagick", "Images", "LaTeXStrings", "LibGit2", "Random", "RDatasets", "StatsPlots", "Test", "UnicodePlots", "VisualRegressionTests"] diff --git a/src/Plots.jl b/src/Plots.jl index 54d34615..731acd49 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -1,6 +1,6 @@ module Plots -_current_plots_version = v"0.26.1" +const _current_plots_version = VersionNumber(split(first(filter(line -> occursin("version", line), readlines(normpath(@__DIR__, "..", "Project.toml")))), "\"")[2]) using Reexport diff --git a/test/imgcomp.jl b/test/imgcomp.jl index 96f41809..e7151573 100644 --- a/test/imgcomp.jl +++ b/test/imgcomp.jl @@ -14,7 +14,6 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = !i fn = "ref$idx.png" reffn = reference_file(pkg, idx, _current_plots_version) newfn = joinpath(reference_path(pkg, _current_plots_version), fn) ->>>>>>> use PlotReferenceImages Julia Package for tests # test function func = (fn, idx) -> begin diff --git a/test/runtests.jl b/test/runtests.jl index 4e64928f..e8a1f687 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,10 +3,32 @@ using Plots using Random using Test using FileIO -using PlotReferenceImages using Gtk ->>>>>>> use PlotReferenceImages Julia Package for tests +reference_dir(args...) = joinpath(homedir(), ".julia", "dev", "PlotReferenceImages", args...) + +function reference_file(backend, i, version) + refdir = reference_dir("Plots", string(backend)) + fn = "ref$i.png" + versions = sort(VersionNumber.(readdir(refdir)), rev = true) + + reffn = joinpath(refdir, string(version), fn) + for v in versions + tmpfn = joinpath(refdir, string(v), fn) + if isfile(tmpfn) + reffn = tmpfn + break + end + end + + return reffn +end + +reference_path(backend, version) = reference_dir("Plots", string(backend), string(version)) + +if !isdir(reference_dir()) + LibGit2.clone("https://github.com/JuliaPlots/PlotReferenceImages.jl.git", reference_dir()) +end include("imgcomp.jl") # don't actually show the plots