Skip to content

fix(docs): drop testthat from the whereInStack example (main) - #50

Merged
eliotmcintire merged 1 commit into
mainfrom
fix/example-without-testthat-main
Sep 4, 2026
Merged

fix(docs): drop testthat from the whereInStack example (main)#50
eliotmcintire merged 1 commit into
mainfrom
fix/example-without-testthat-main

Conversation

@eliotmcintire

Copy link
Copy Markdown
Contributor

Cherry-pick (-x) of 6035823 from #49, so main has it before #44 lands.

The whereInStack example ended with testthat::expect_error(findB3()). testthat is in Suggests, so under _R_CHECK_DEPENDS_ONLY_ it is not on the library path and R CMD check fails:

* checking examples ... ERROR
Error in loadNamespace(x) : there is no package called 'testthat'

Replaced with try(findB3()) in R/plotting.R and man/whereInStack.Rd. try() is the better call anyway — the line exists to show that dynGet("b$a") fails, and try() prints that error where expect_error() swallowed it.

Why it has to be on main

This is the last red square in #44's matrix. Run 33928053320, after #48 landed:

Leg
ubuntu-latest devel, release, oldrel-1, oldrel-2, oldrel-3
ubuntu-latest release, nosuggests examples ERROR — this PR
windows-latest devel, release, oldrel-1, oldrel-2
macOS-latest release
test-coverage
pkgdown

The nosuggests leg's tests already pass — FAIL 0 | SKIP 12 | PASS 82, the 9 image tests skipped by the guard from #46/#48. Only the examples check fails, and only for this one line.

Verification

R/plotting.R and man/whereInStack.Rd on this branch are identical to fix/example-without-testthat (#49); the only differences between the two branches are the pre-existing main / development divergences (.Rbuildignore, CRAN-SUBMISSION, cran-comments.md, revdeps.yaml, DESCRIPTION version, the res = / resolution = split).

As with #48, a PR into main gets no R-CMD-check — main's current workflow triggers on [master, development]. Merge this, re-trigger #44, and that run is the verification.

🤖 Generated with Claude Code

https://claude.ai/code/session_011kpoQV6nNqcknk16R3RzBB

The last line of the whereInStack example called

  testthat::expect_error(findB3())

testthat is in Suggests, so under `_R_CHECK_DEPENDS_ONLY_` it is not on the
library path and R CMD check fails outright:

  * checking examples ... ERROR
  Error in loadNamespace(x) : there is no package called 'testthat'
  * checking examples with --run-donttest ... ERROR

`try()` is a better fit regardless. The point of that line is to show the
reader that dynGet("b$a") fails because `b$a` is not an object name, and try()
prints the error where expect_error() swallowed it -- so the example now
demonstrates the thing it is describing, to every reader, whether or not they
have testthat installed. Verified it still errors identically:

  Error in dynGet("b$a") : 'b$a' not found

Found by the nosuggests leg of PR #44's matrix, which is the first
`_R_CHECK_DEPENDS_ONLY_` check this package has ever had. Its tests now pass
there (FAIL 0 | SKIP 12 | PASS 82, the 9 image tests skipped by #46's guard);
this was the only remaining failure on that leg, and the last red square in an
otherwise green 11-leg matrix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011kpoQV6nNqcknk16R3RzBB
(cherry picked from commit 6035823)
@eliotmcintire
eliotmcintire merged commit 59ca9d0 into main Sep 4, 2026
2 checks passed
@eliotmcintire
eliotmcintire deleted the fix/example-without-testthat-main branch September 4, 2026 23:47
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