From b6bf180c6c1b4768302f49f2515d8c24a2bb5f23 Mon Sep 17 00:00:00 2001 From: Miguel Bazdresch Date: Tue, 2 Apr 2024 21:16:04 -0400 Subject: [PATCH] Fix tests for v1.6 --- src/Gaston.jl | 21 ++++++++++++++++++++- test/runtests.jl | 12 ++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/Gaston.jl b/src/Gaston.jl index 3b4b7d1..8e93496 100644 --- a/src/Gaston.jl +++ b/src/Gaston.jl @@ -66,9 +66,27 @@ function showable(mime::MIME"image/svg+xml", f::Figure) return false end +function gp_start() + global P + gstdin = Pipe() + gstdout = Pipe() + gstderr = Pipe() + gproc = run(pipeline(`gnuplot`, + stdin = gstdin, stdout = gstdout, stderr = gstderr), + wait = false) + process_running(gproc) || error("There was a problem starting up gnuplot.") + close(gstdout.in) + close(gstderr.in) + close(gstdin.out) + Base.start_reading(gstderr.out) + P.gstdin = gstdin + P.gstdout = gstdout + P.gstderr = gstderr +end + # initialize gnuplot function __init__() - global P, gnuplot_state, GNUPLOT_VERSION + global gnuplot_state gnuplot_state.gnuplot_available = false @@ -76,6 +94,7 @@ function __init__() code = success(`gnuplot --version`) if code gnuplot_state.gnuplot_available = true + gp_start() else @warn ("There was a problem starting gnuplot. Gaston will be unable to produce any plots.") end diff --git a/test/runtests.jl b/test/runtests.jl index c2a9717..23c1639 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -473,7 +473,11 @@ end @test_throws TypeError closefigure(1.0) @test_throws TypeError closefigure(1:2) # plot - @test_throws ArgumentError p = plot(0:10,0:11) + if VERSION < v"1.7-" + @test_throws ArgumentError p = plot(0:10,0:11) + else + @test_throws DimensionMismatch p = plot(0:10,0:11) + end #@test_throws DimensionMismatch surf([1,2],[3,4],[5,6,7]) #@test_throws DimensionMismatch surf([1,2,3],[3,4],[5,6,7]) #plot! @@ -481,7 +485,11 @@ end @test_throws ErrorException p = plot!(0:10) # imagesc z = rand(5,6) - @test_throws ArgumentError imagesc(1:5,1:7,z) + if VERSION < v"1.7-" + @test_throws ArgumentError imagesc(1:5,1:7,z) + else + @test_throws DimensionMismatch imagesc(1:5,1:7,z) + end # histogram #@test_throws MethodError histogram(0:10+im*0:10) # save