Skip to content

rstudio-tests r scope passes when a testthat test errors #19648

Open

Description

@kevinushey

src/cpp/tests/testthat/run-tests.R decides whether the r test scope failed from sum(as.data.frame(results)$failed), which it writes to testthat-failures.log for checkRUnitTestFailure in rstudio-tests. testthat's failed column counts failed expectations only: a test that raises an error has failed == 0 and error == TRUE. So a testthat case that errors, rather than failing an expectation, leaves testthat-failures.log at 0, rstudio-tests --scope r exits 0, and CI passes.

Seen on macOS with testthat 3.3.2 while working on #19640: a test whose code errored inside expect_true() was reported by testthat as [ FAIL 1 | WARN 0 | SKIP 0 | PASS 40 ], but testthat-failures.log held 0 and the run exited 0.

A fix is to count errored tests too, e.g. sum(df$failed) + sum(df$error). Any test that errors today would then start failing CI, so the full r scope should be run first to see whether there are any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions