Skip to content

fix(pkg-r): skip tests that assume Suggests packages are installed - #317

Merged
gadenbuie merged 2 commits into
mainfrom
fix/cran-failures-2026-09
Sep 29, 2026
Merged

gadenbuie merged 2 commits into
mainfrom
fix/cran-failures-2026-09

Conversation

@gadenbuie

@gadenbuie gadenbuie commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

CRAN's r-devel-linux-x86_64-fedora-clang check errored because duckdb (a Suggests dependency) isn't installed on that machine: 92 test errors from check_installed("duckdb") plus 4 failures where tests silently fell back to SQLite and then failed DuckDB-specific expectations.

  • skip_if_no_dataframe_engine() is now engine-aware: with an explicit engine it skips unless that engine's package is installed; with NULL it keeps the old any-engine semantics. Previously it only skipped when neither duckdb nor RSQLite was installed, so it never fired when RSQLite masked the missing duckdb.
  • local_data_frame_source(), local_recording_data_frame_source(), and local_querychat() (for data.frame inputs) now skip automatically.
  • Tests that construct DataFrameSource/QueryChat directly gained guards: 8 describe blocks + 3 test_that() blocks, plus 3 explicit skip_if_not_installed("duckdb") in DuckDB-asserting tests.

Audited all Suggests packages by running the full suite with each Suggests dependency (except the testthat/withr harness and later, a hard dependency of shiny) shadowed by broken stubs — the worst-case scenario CRAN could present. That surfaced 46 additional tests failing when both duckdb and RSQLite are absent, all fixed by the guards above.

@gadenbuie
gadenbuie requested a review from cpsievert September 29, 2026 21:28
CRAN's r-devel-linux-x86_64-fedora-clang flavor has RSQLite but not
duckdb installed, which caused the test suite to ERROR:

- 92 errors: tests requesting engine = "duckdb" (explicitly or via the
  local_data_frame_source() fixture default) hard-failed in
  check_installed("duckdb"), including one variant where the
  non-interactive check surfaced as "menu() cannot be used
  non-interactively"
- 4 failures: tests using the default engine silently fell back to
  SQLite and then failed DuckDB-specific expectations

skip_if_no_dataframe_engine() only skipped when *neither* engine was
installed, so it never fired on that machine, and it had no way to
express "this test requires a specific engine". It is now engine-aware:

- with engine = NULL, keep the old any-engine semantics (mirroring how
  DataFrameSource resolves a default engine)
- with a specific engine, skip unless that engine's package is
  installed, so tests no longer silently degrade to another engine

local_data_frame_source() and local_recording_data_frame_source() now
call it with their requested engine, and local_querychat() skips for
plain data.frame inputs, so fixture-based tests skip automatically.
Tests that construct DataFrameSource or QueryChat directly gained
skip_if_no_dataframe_engine() guards (6 describe blocks and 3
test_that() blocks in test-QueryChat.R, 2 describe blocks in
test-QueryChatSystemPrompt.R, plus 3 explicit skip_if_not_installed
("duckdb") calls in DuckDB-asserting tests).

Audited all Suggests packages by running the full suite with every
Suggests dependency (except the testthat/withr harness and later,
which is a hard dependency of shiny) shadowed by broken stubs. That
surfaced 46 additional tests failing on "no compatible database
engine" with both engines absent, all fixed by the guards above.

Verified by simulating the CRAN condition (FAIL 0, SKIP 98, PASS
716 for the duckdb-only case), a full Suggests blackout (FAIL 0,
SKIP 199, PASS 1198), and with everything installed (FAIL 0, SKIP 0,
PASS 2195, twice).
@gadenbuie
gadenbuie force-pushed the fix/cran-failures-2026-09 branch from 7108ffc to 7a56f67 Compare September 29, 2026 21:37
@gadenbuie
gadenbuie merged commit dd18842 into main Sep 29, 2026
10 checks passed
@gadenbuie
gadenbuie deleted the fix/cran-failures-2026-09 branch September 29, 2026 21:44
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

Successfully merging this pull request may close these issues.

1 participant