Skip to content

Commit

Permalink
Fix get_gisbase error
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenpawley committed Jan 21, 2025
1 parent 4716073 commit be868ad
Show file tree
Hide file tree
Showing 3 changed files with 213 additions and 213 deletions.
4 changes: 2 additions & 2 deletions tests/testthat/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ get_gisbase <- function() {
if (Sys.info()["sysname"] == "Linux") {
gisBase <- try(system2("grass", "--config path", stdout = TRUE), silent = TRUE)
} else {
gisBase <- try(Sys.getenv("GRASS_INSTALLATION"), silent = TRUE)
gisBase <- Sys.getenv("GRASS_INSTALLATION")
}

if (inherits(gisBase, "try-error")) {
if (inherits(gisBase, "try-error") | gisBase == "") {
message("GRASS GIS not found on PATH")
return(NULL)
}
Expand Down
5 changes: 2 additions & 3 deletions tests/testthat/test-execGRASS.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ test_that("testing basic doGRASS, execGRASS, stringexecGRASS", {

# Try executing 'r.stats' command which will fail because "fire_blocksgg"
# does not exist in the mapset
# TODO execGRASS error does not appear as an error on windows
expect_equal(
expect_error(
res <- execGRASS("r.stats", input = "fire_blocksgg", flags = c("c", "n")),
1
"ERROR:"
)

# Test using an invalid parameter
Expand Down
Loading

0 comments on commit be868ad

Please sign in to comment.