rcmdcheck examples failing, but devtools::run_examples(fresh = TRUE) works?

Hi! I'm struggling with R CMD check finding errors in my package examples, but not when I run devtools::run_examples(fresh = TRUE).

The package in question is here: https://github.com/DynastyProcess/ffscrapr (the failing branch being feature/env)

and an example of (an automated) check failure: https://github.com/DynastyProcess/ffscrapr/pull/25/checks?check_run_id=863291803

and yet the same example works fine via devtools::run_example(fresh = TRUE) :

I started getting this issue specifically in this feature branch, which involved moving an object into the global environment via the .onLoad() function in zzz.R, and then I'm referencing it via get() in my main package functions, so I'm curious if it's related to not finding the object in the global env.

Would love to hear any thoughts!

Ended up refactoring the global environment object (which in itself was an environment) by putting it into the baseenv() instead, and then referring to that environment instead of just using inherits = TRUE in the succeeding get and assign functions. That seems to have solved the problem! (the changes that solved it are shown in this git diff https://github.com/DynastyProcess/ffscrapr/pull/25/commits/f5a2d890df3f9f3a05cb934ed2002e6308d32c40)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.