Skip to content

Commit

Permalink
test: do not query system keyring on CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
aoles committed Oct 20, 2024
1 parent c2287da commit ac9f31e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: openrouteservice
Title: An 'openrouteservice' API Client
Version: 0.6.0
Version: 0.6.1
Authors@R: c(
person("Heidelberg Institute for Geoinformation Technology (HeiGIT) gGmbH", role = "cph"),
person(c("Andrzej", "K."), "Oleś", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-0285-2787"))
Expand Down
6 changes: 5 additions & 1 deletion tests/testthat/test-api_key.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
context("Key management")

on_cran <- function() {
!interactive() && !isTRUE(as.logical(Sys.getenv("NOT_CRAN", "false")))
}

## record current state before starting any tests
env <- Sys.getenv("ORS_API_KEY", NA);
key <- tryCatch(keyring::key_get("openrouteservice"), error = function(e) NA)
key <- tryCatch(if (on_cran()) NA else keyring::key_get("openrouteservice"), error = function(e) NA)

## restore initial state
on.exit({
Expand Down

0 comments on commit ac9f31e

Please sign in to comment.