timplement better error handling depending on PyPlot status - Granular.jl - Jul… | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 5a146a48bf313d33a61b3a324a9d2561df839bec | |
parent a19598f72d623c1a082fb021860e7b4f7bbc58eb | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 3 Oct 2017 16:51:04 -0400 | |
implement better error handling depending on PyPlot status | |
Diffstat: | |
M src/icefloe.jl | 2 +- | |
M test/icefloe.jl | 22 +++++++++++++--------- | |
2 files changed, 14 insertions(+), 10 deletions(-) | |
--- | |
diff --git a/src/icefloe.jl b/src/icefloe.jl | |
t@@ -699,7 +699,7 @@ function plotIceFloeSizeDistribution(simulation::Simulatio… | |
log_y::Bool = true) | |
if !hasPyPlot | |
- warn("Function not available because PyPlot is not installed") | |
+ error("Function not available because PyPlot is not installed") | |
return | |
end | |
diameters = Float64[] | |
diff --git a/test/icefloe.jl b/test/icefloe.jl | |
t@@ -29,12 +29,16 @@ SeaIce.addIceFloeCylindrical!(sim, [ 0., 0.], 10., 1., ver… | |
SeaIce.addIceFloeCylindrical!(sim, [ 0., 0.], 10., 1., verbose=false) | |
SeaIce.compareIceFloes(sim.ice_floes[1], sim.ice_floes[2]) | |
-SeaIce.plotIceFloeSizeDistribution(sim) | |
-rm("test-ice-floe-size-distribution.png") | |
-SeaIce.plotIceFloeSizeDistribution(sim, skip_fixed=false) | |
-rm("test-ice-floe-size-distribution.png") | |
-SeaIce.plotIceFloeSizeDistribution(sim, log_y=false) | |
-rm("test-ice-floe-size-distribution.png") | |
-SeaIce.plotIceFloeSizeDistribution(sim, size_type="areal") | |
-rm("test-ice-floe-size-distribution.png") | |
-@test_throws ErrorException SeaIce.plotIceFloeSizeDistribution(sim, size_type=… | |
+if typeof(Pkg.installed("PyPlot")) == VersionNumber | |
+ SeaIce.plotIceFloeSizeDistribution(sim) | |
+ rm("test-ice-floe-size-distribution.png") | |
+ SeaIce.plotIceFloeSizeDistribution(sim, skip_fixed=false) | |
+ rm("test-ice-floe-size-distribution.png") | |
+ SeaIce.plotIceFloeSizeDistribution(sim, log_y=false) | |
+ rm("test-ice-floe-size-distribution.png") | |
+ SeaIce.plotIceFloeSizeDistribution(sim, size_type="areal") | |
+ rm("test-ice-floe-size-distribution.png") | |
+ @test_throws ErrorException SeaIce.plotIceFloeSizeDistribution(sim, size_t… | |
+else | |
+ @test_throws ErrorException SeaIce.plotIceFloeSizeDistribution(sim) | |
+end |