Skip to content

Commit

Permalink
print test file names
Browse files Browse the repository at this point in the history
  • Loading branch information
JsLth committed Sep 19, 2024
1 parent bafbbac commit d9929f4
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
extra-packages: any::covr, any::scriptName
needs: coverage

- name: Java sanity check
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-assertions.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
print(basename(scriptName::current_source_filename()$value))

test_that("types are evaluated in error messages", {
expect_error(assert_that(is_integerish(NULL)), regexp = "of type NULL")
expect_error(assert_that(is_true_or_false("test")), regexp = "of type character")
Expand Down
14 changes: 2 additions & 12 deletions tests/testthat/test-jar.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
print(basename(scriptName::current_source_filename()$value))

test_that("properly stops without java", {
expect_error(with_mocked_bindings(
has_util = function(...) FALSE,
Expand All @@ -13,35 +15,23 @@ ors <- local_ors_instance(type = "jar", verbose = FALSE)

test_that("jar setup works", {
# service not started - should return false
print(1)
expect_false(ors$is_init())
print(2)
expect_false(ors$is_running())
print(3)
expect_false(ors$is_ready())
print(4)
expect_true(ors$is_mounted())
print(5)

# check if service is startable
ors$set_extract(file = system.file("setup/monaco.pbf", package = "rors"))
print(6)
ors$set_port()
print(7)
ors$up()
print(8)

# service is started - should return true
expect_true(ors$is_init())
print(9)
expect_true(ors$is_running())
print(10)
expect_true(ors$is_ready())
print(11)

# stop
ors$stop()
print(12)
expect_false(ors$is_running())
expect_true(ors$is_init())
})
2 changes: 2 additions & 0 deletions tests/testthat/test-local-parse.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
print(basename(scriptName::current_source_filename()$value))

skip_if_offline("github.com")

ors <- local_ors_instance(verbose = FALSE, dry = TRUE)
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-local-write.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
print(basename(scriptName::current_source_filename()$value))

test_that("env files are written correctly", {
lst <- list(
test1 = NULL,
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-params.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ test_that("fails early", {
expect_error(prepare_ors_params(p3, "driving-car"), class = "ors_param_invalid_child_error")
})

print(basename(scriptName::current_source_filename()$value))

test_that("param checking works", {
v1 <- list(geometry_simplify = TRUE)
v2 <- list(geometry_simplify = c(TRUE, TRUE))
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-remote.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
print(basename(scriptName::current_source_filename()$value))

test_that("ors_token() works", {
withr::with_envvar(
c(ORS_TOKEN = ""),
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-requests.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
print(basename(scriptName::current_source_filename()$value))

# this test file is both the core part and the part that is causing the
# biggest headache! If not absolutely possible, it only runs on mocks. If not
# absolutely necessary, it does not run at all. Mocks are fed on local machines
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-sample.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
print(basename(scriptName::current_source_filename()$value))

skip_if_not(sf::sf_extSoftVersion()["GDAL"] > "2.1.0")
skip_on_cran()

Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-utils-ors.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
print(basename(scriptName::current_source_filename()$value))

skip_if(!loadable("webfakes"), "webfakes unavailable")
skip_webfakes <- function(web) {
failed <- inherits(web, "try-error")
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
print(basename(scriptName::current_source_filename()$value))

test_that("%||% works", {
expect_equal(1 %||% 2, 1)
expect_equal(NULL %||% 2, 2)
Expand Down

0 comments on commit d9929f4

Please sign in to comment.