Skip to content

Commit

Permalink
skip france test on cran - long running time
Browse files Browse the repository at this point in the history
  • Loading branch information
Cidree committed Dec 13, 2024
1 parent 33791a4 commit 5427913
Showing 1 changed file with 19 additions and 26 deletions.
45 changes: 19 additions & 26 deletions tests/testthat/test-forest-country.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,45 +30,38 @@ test_that("All files are downloaded", {

# 2. France ---------------------------------------------------------------

## 1.1. Get data -------------------

## Get 1 file
hautes_alpes_forest_v2 <- fd_forest_france(
department = metadata_forestdata$bdforet_tbl_departments[5],
quiet = FALSE
)

## Get 1 file from DB Foret 1
hautes_alpes_forest_v1 <- fd_forest_france(
department = metadata_forestdata$bdforet_tbl_departments[5],
version = 1,
quiet = TRUE
)

## 1.2. Unit tests ------------------

## Check data type is correct, and data is download
test_that("Data is downloaded properly for DB Foret v2", {
skip_on_cran()
## get data
hautes_alpes_forest_v2 <- fd_forest_france(
department = metadata_forestdata$bdforet_tbl_departments[5],
quiet = FALSE
)
## test
expect_equal(class(hautes_alpes_forest_v2)[1], "sf")
expect_gt(nrow(hautes_alpes_forest_v2), 10)
expect_equal(
names(hautes_alpes_forest_v2),
c("ID", "CODE_TFV", "TFV", "TFV_G11", "ESSENCE", "geometry")
)
})

test_that("Data is downloaded properly for DB Foret v1", {
## Get 1 file from DB Foret 1
hautes_alpes_forest_v1 <- fd_forest_france(
department = metadata_forestdata$bdforet_tbl_departments[5],
version = 1,
quiet = TRUE
)
## test
expect_equal(class(hautes_alpes_forest_v1)[1], "sf")
expect_gt(nrow(hautes_alpes_forest_v1), 10)
})

## Check column names
test_that("Column names are the correct ones for v1", {
expect_equal(
names(hautes_alpes_forest_v1),
c("DEP", "CYCLE", "ANREF", "TFIFN", "LIBELLE", "LIBELLE2", "TYPN", "NOM_TYPN", "geometry")
)
})

test_that("Column names are the correct ones for v2", {
expect_equal(
names(hautes_alpes_forest_v2),
c("ID", "CODE_TFV", "TFV", "TFV_G11", "ESSENCE", "geometry")
)
})

0 comments on commit 5427913

Please sign in to comment.