Skip to content

fix(docs): drop testthat from the whereInStack example (last red leg on #44) - #49

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

fix(docs): drop testthat from the whereInStack example (last red leg on #44)#49
eliotmcintire merged 1 commit into
developmentfrom
fix/example-without-testthat

Conversation

@eliotmcintire

Copy link
Copy Markdown
Contributor

The whereInStack example ended with:

testthat::expect_error(findB3()) # fails because not an object name

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

Replaced with try(findB3()), in R/plotting.R and the corresponding man/whereInStack.Rd (hand-edited to match, rather than re-running roxygen and churning every other .Rd).

try() is the better call 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. The example now demonstrates the thing it describes, for every reader, testthat installed or not. Verified it errors identically:

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

How this surfaced

#44's nosuggests leg is the first _R_CHECK_DEPENDS_ONLY_ check this package has ever run. After #46's guard landed, its tests pass there — FAIL 0 | SKIP 12 | PASS 82, with the 9 image tests skipped as designed. This examples ERROR was the only thing left, and the only red square in an otherwise green 11-leg matrix on run 33928053320:

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

oldrel-3 passing is also new information: it is the first verification of the R (>= 4.3) floor that DESCRIPTION has been asserting.

Note

This leg cannot be exercised from a PR into development — the nosuggests leg only exists in the shared matrix that #44 introduces. Verification is #44's own re-run once this is on main (see the companion cherry-pick PR).

🤖 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
@eliotmcintire
eliotmcintire merged commit a49fab6 into development Sep 4, 2026
11 checks passed
@eliotmcintire
eliotmcintire deleted the fix/example-without-testthat 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