Skip to content

Commit

Permalink
refactor(sdt)?: move to test item
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisot committed Oct 16, 2023
1 parent 088a1be commit f547fbd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 28 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SimpleSDMDatasets = "2c7d61d0-5c73-410d-85b2-d2e7fbbdcefa"
SimpleSDMLayers = "2c645270-77db-11e9-22c3-0f302a89c64c"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"

[compat]
ArchGDAL = "0.9, 0.10"
Expand Down
10 changes: 10 additions & 0 deletions src/io/geotiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,13 @@ function _write_geotiff(
) where {T <: Number}
return _write_geotiff(file, convert.(SimpleSDMPredictor, layers); kwargs...)
end

@testitem "We can write a GeoTiff file" begin

layer = SimpleSDMPredictor(RasterData(EarthEnv, LandCover); layer = 1)
D = SimpleSDMLayers._inner_type(layer)

f = tempname()
SpeciesDistributionToolkit._write_geotiff(f, [layer]; driver = "GTiff", nodata = typemax(D))
@test isfile(f)
end
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[deps]
GDAL = "add2ef01-049f-52c4-9ee2-e494f65e021a"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
30 changes: 2 additions & 28 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
using SpeciesDistributionToolkit
using Test
using TestItemRunner

global anyerrors = false

tests = [
"read/write layers" => "01_integration_read.jl",
"EDGE: stitch bounding box" => "edgecases/01_stitch_wrong_bb.jl",
"EDGE: clip & GDAL" => "edgecases/02_clip_gdalwarp.jl",
"EDGE: keychecker" => "edgecases/03_layers_keycheck.jl",
]

for test in tests
try
include(test.second)
println("\033[1m\033[32m✓\033[0m\t$(test.first)")
catch e
global anyerrors = true
println("\033[1m\033[31m×\033[0m\t$(test.first)")
println("\033[1m\033[38m→\033[0m\ttest/$(test.second)")
showerror(stdout, e, backtrace())
println()
break
end
end

if anyerrors
throw("Tests failed")
end
@run_package_tests filter=ti->!(:skipci in ti.tags) verbose=true

0 comments on commit f547fbd

Please sign in to comment.