Skip to content

Unexpected message and test skipping when using extended_types = TRUE #515

Description

@jeanetteclark

I'm using RSQLite as the backend data store/access for a package designed to retrieve and access some fish data. When running tests, which involve creating the database using RSQLite as part of the setup, I saw some strange output ( {.fn {top_level_fun}} needs the {.pkg {.val {pkgs_not_installed}}} package{?s}. and noticed that most of my tests were being skipped. You can recreate the behavior by doing the below - my apologies for the complexity I'm not sure if I could recreate it outside of the packaging context.

I believe that the cryptic message itself is generated here, and the actual problem is that I didn't have the hms package installed, which this line checks for. Additionally, I think that dbConnect is not a package anymore?

Finally, I also question whether it is appropriate to force users to skip tests - had we not had other tests failing downstream because of the earlier skipped setup tasks, we might not have realized that all of our tests were being skipped on GHA.

In the end, I was able to resolve the issue by adding hms to Suggests. However, this behavior seems not ideal and it took me forever to figure out what the heck was happening, so I thought I'd bring it to your attention.

Reprex

# from outside a project
remove.packages("hms")
usethis::create_package("testRSQLbug")
# switch to testRSQLbug project
usethis::use_package("RSQLite")
usethis::use_package("DBI")
usethis::use_testthat()
usethis::use_test("test_connect")
test_that("test connect", {
    mydb <- DBI::dbConnect(RSQLite::SQLite(), "my-db.sqlite", extended_types = TRUE)
    expect_s4_class(mydb, "SQLiteConnection")
    DBI::dbDisconnect(mydb)
})

output from testing

==> devtools::test()

ℹ Testing testRSQbug
✔ | F W  S  OK | Context
✔ |      1   0 | test_package_loading                        

══ Results ══════════════════════════════════════════════════
── Skipped tests (1) ────────────────────────────────────────
• {.fn {top_level_fun}} needs the {.pkg {.val
  {pkgs_not_installed}}} package{?s}. (1):
  test-test_package_loading.R:4:5

[ FAIL 0 | WARN 0 | SKIP 1 | PASS 0 ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions