Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapereirabr committed Feb 19, 2020
1 parent 85c5725 commit 57cace8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -24,4 +24,4 @@ script:
- travis_wait 120 R CMD check *tar.gz

after_success:
- travis_wait Rscript -e 'covr::codecov()'
- travis_wait 120 Rscript -e 'covr::codecov()'
16 changes: 3 additions & 13 deletions r-package/tests/testthat/test-read_amazon.R
@@ -1,18 +1,15 @@
context("Read")

context("read_amazon")

# skip tests because they take too much time
skip_if(Sys.getenv("TEST_ONE") != "")
testthat::skip_on_cran()
testthat::skip_on_travis()


# Reading the data -----------------------

test_that("read_amazon", {

# skip tests because they take too much time
skip_on_cran()
skip_on_travis()

# read data
expect_message(read_amazon(year=NULL))
test_sf <- read_amazon(year=2012)
Expand All @@ -34,15 +31,8 @@ test_that("read_amazon", {
# ERRORS and messagens -----------------------
test_that("read_amazon", {

# skip tests because they take too much time
skip_on_cran()
skip_on_travis()


# Wrong year
expect_error(read_amazon(year=9999999))
expect_error(read_amazon(year="xxx"))

})


21 changes: 7 additions & 14 deletions r-package/tests/testthat/test-read_biomes.R
@@ -1,17 +1,15 @@
context("Read")
context("read_biomes")


# Reading the data -----------------------
# skip tests because they take too much time
skip_if(Sys.getenv("TEST_ONE") != "")
testthat::skip_on_cran()
testthat::skip_on_travis()


# Reading the data -----------------------

test_that("read_biomes", {

# skip tests because they take too much time
skip_on_cran()
# skip_on_travis()


# read data
expect_message(read_biomes(year=NULL))
test_sf <- read_biomes(year=2004)
Expand All @@ -23,7 +21,7 @@ test_that("read_biomes", {
expect_equal(test_sf$code_biome %>% length(), 10)

# check projection
# expect_equal(sf::st_crs(test_sf)[[2]], "+proj=longlat +ellps=GRS80 +no_defs")
expect_equal(sf::st_crs(test_sf)[[2]], "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs")

})

Expand All @@ -33,11 +31,6 @@ test_that("read_biomes", {
# ERRORS and messagens -----------------------
test_that("read_biomes", {

# skip tests because they take too much time
skip_on_cran()
# skip_on_travis()


# Wrong year
expect_error(read_biomes(year=9999999))
expect_error(read_biomes(year="xxx"))
Expand Down
18 changes: 7 additions & 11 deletions r-package/tests/testthat/test-read_census_tract.R
@@ -1,11 +1,12 @@
context("Read")
context("read_census_tract")

# skip tests because they take too much time
skip_if(Sys.getenv("TEST_ONE") != "")
testthat::skip_on_cran()
testthat::skip_on_travis()

test_that("read_census_tract", {

# skip tests because they take too much time
#skip_if(Sys.getenv("TEST_ONE") != "")
skip_on_cran()
# skip_on_travis()
test_that("read_census_tract", {

# read data
test_code_2000 <- read_census_tract(code_tract = 1100023, year = 2000)
Expand Down Expand Up @@ -48,11 +49,6 @@ test_that("read_census_tract", {
# ERRORS
test_that("read_census_tract", {

# skip tests because they take too much time
#skip_if(Sys.getenv("TEST_ONE") != " ")
skip_on_cran()
# skip_on_travis()

# Wrong year and code
expect_error(read_census_tract(code_tract = 9999999, year = 9999999))
expect_error(read_census_tract(code_tract = 9999999, year = "xxx"))
Expand Down
16 changes: 7 additions & 9 deletions r-package/tests/testthat/test-read_municipality.R
@@ -1,10 +1,12 @@
context("Read")
context("read_municipality")

# skip tests because they take too much time
skip_if(Sys.getenv("TEST_ONE") != "")
testthat::skip_on_cran()
testthat::skip_on_travis()

test_that("read_municipality", {

# skip tests because they take too much time
skip_on_cran()
# skip_on_travis()
test_that("read_municipality", {

# read data
test_code_1991 <- read_municipality(code_muni=1200179, year=1991)
Expand Down Expand Up @@ -46,10 +48,6 @@ test_that("read_municipality", {
# ERRORS
test_that("read_municipality", {

# skip tests because they take too much time
skip_on_cran()
# skip_on_travis()

# Wrong year and code
expect_error(read_municipality(code_muni=9999999, year=9999999))
expect_error(read_municipality(code_muni=9999999, year="xxx"))
Expand Down
17 changes: 8 additions & 9 deletions r-package/tests/testthat/test-read_statistical_grid.R
@@ -1,11 +1,14 @@
context("Read")
context("read_statistical_grid")

# skip tests because they take too much time
skip_if(Sys.getenv("TEST_ONE") != "")
testthat::skip_on_cran()
testthat::skip_on_travis()


test_that("read_statistical_grid", {

# skip tests because they take too much time
skip_on_cran()
# skip_on_travis()

test_that("read_statistical_grid", {

# read data
test_quad_code <- read_statistical_grid(code_grid=44, year=2010)
Expand Down Expand Up @@ -44,10 +47,6 @@ test_that("read_statistical_grid", {
# ERRORS
test_that("read_statistical_grid", {

# skip tests because they take too much time
skip_on_cran()
# skip_on_travis()

# Wrong year and code
expect_error(read_statistical_grid(code_grid=9999999, year=9999999))
expect_error(read_statistical_grid(code_grid=9999999, year="xxx"))
Expand Down

0 comments on commit 57cace8

Please sign in to comment.