inbo / etn

R package to access data from the European Tracking Network
https://inbo.github.io/etn/
MIT License
6 stars 5 forks source link

tests for `connect_to_etn()` deprecation fail in R CMD CHECK, order matters? #319

Open PietrH opened 6 days ago

PietrH commented 6 days ago

I found a strange bug in #313

The tests for the connect_to_etn() deprecation fail, but only when running R CMD CHECK, or devtools::test(filter = "connect_to_etn"), but not when clicking Run Tests or when I try running R CMD CHECK locally. Maëlle also tried, and had no failures locally.

The order of the tests also seems to matter, as the first test always passes, and the 2nd and 3rd then fail:


test_that("connect_to_etn() returns deprecation warning when used with named arguments", {
  lifecycle::expect_deprecated(
    connect_to_etn(username = "my name", password = "my password")
  )
})

test_that("connect_to_etn() returns deprecation warning when used with unnamed arguments", {
  skip("")
  lifecycle::expect_deprecated(
    connect_to_etn("my name", "my password")
  )
})

test_that("connect_to_etn() returns deprecation argument when used without arguments",{
  lifecycle::expect_deprecated(
    connect_to_etn()
  )
})

We suspected for a moment it might have something to do with the lifecyle behavior around options(lifecycle_verbosity). However, expect_deprecated() should set this option to warn:

expect_deprecated() sets the lifecycle_verbosity option to "warning" to enforce deprecation warnings which are otherwise only shown once every 8 hours.

And, our function has always = TRUE so it should warn every time anyways.

Also tried with expect_warn and have the same issues there.