Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test relies on {tibble} in an opaque way #481

Open
MichaelChirico opened this issue Nov 25, 2024 · 0 comments
Open

Test relies on {tibble} in an opaque way #481

MichaelChirico opened this issue Nov 25, 2024 · 0 comments

Comments

@MichaelChirico
Copy link
Contributor

expect_s3_class(x, "tbl_df")

Recent update of {waldo} to drop {tibble} as a required package caused this test to break for us (because now {tibble} needs to be included intentionally for testing).

The failure mode is pretty opaque:

══ Failed tests ════════════════════════════════════════════════════════════════
── Failure (test-file.R:42:7): file_info: can be subset as a tibble ────────────
`x` inherits from 'data.frame' not 'tbl_df'.

Suggestions:

  1. skip_if_not_installed("tibble")
  2. Write requireNamespace("tibble") clearly in the test body to make the connection to {tibble} crystal clear
  3. Use withr::local_options(list(fs.use_tibble=FALSE)) to make this test independent of {tibble}:

fs/R/utils.R

Lines 135 to 139 in 8d40528

if (getOption("fs.use_tibble", TRUE) && is_installed("tibble")) {
tibble::as_tibble(x)
} else {
x
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant