Skip to content

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

Open
@MichaelChirico

Description

@MichaelChirico

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions