pyplot figure finalizer; accept 2-len AVec for limits (#289); sleep/skip/only options in test_examples
This commit is contained in:
parent
2dd480a3a6
commit
3b325b2482
@ -229,7 +229,7 @@ function axis_limits(axis::Axis, should_widen::Bool = default_should_widen(axis)
|
||||
ex = axis[:extrema]
|
||||
amin, amax = ex.emin, ex.emax
|
||||
lims = axis[:lims]
|
||||
if isa(lims, Tuple) && length(lims) == 2
|
||||
if (isa(lims, Tuple) || isa(lims, AVec)) && length(lims) == 2
|
||||
if isfinite(lims[1])
|
||||
amin = lims[1]
|
||||
end
|
||||
|
||||
@ -348,6 +348,7 @@ function _create_backend_figure(plt::Plot{PyPlotBackend})
|
||||
PyPlot.gcf()
|
||||
else
|
||||
PyPlot.figure()
|
||||
finalizer(fig, close)
|
||||
end
|
||||
|
||||
# clear the figure
|
||||
|
||||
@ -325,11 +325,13 @@ function test_examples(pkgname::Symbol, idx::Int; debug = false, disp = true)
|
||||
end
|
||||
|
||||
# generate all plots and create a dict mapping idx --> plt
|
||||
function test_examples(pkgname::Symbol; debug = false, disp = true)
|
||||
function test_examples(pkgname::Symbol; debug = false, disp = true, sleep = nothing,
|
||||
skip = [], only = nothing)
|
||||
Plots._debugMode.on = debug
|
||||
plts = Dict()
|
||||
for i in 1:length(_examples)
|
||||
|
||||
only != nothing && !(i in only) && continue
|
||||
i in skip && continue
|
||||
try
|
||||
plt = test_examples(pkgname, i, debug=debug, disp=disp)
|
||||
plts[i] = plt
|
||||
@ -337,6 +339,9 @@ function test_examples(pkgname::Symbol; debug = false, disp = true)
|
||||
# TODO: put error info into markdown?
|
||||
warn("Example $pkgname:$i:$(_examples[i].header) failed with: $ex")
|
||||
end
|
||||
if sleep != nothing
|
||||
Base.sleep(sleep)
|
||||
end
|
||||
end
|
||||
plts
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user