[R-pkg-devel] Cryptic error on Windows but not Debian

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Sat Nov 18 18:35:28 CET 2023


В Fri, 17 Nov 2023 17:08:13 -0500
Adam <asebsadowski using gmail.com> пишет:

> 1. The example should not be running in the first place, as it has
> @examplesIf megamation:::mm_has_creds(), which should be FALSE for
> CRAN (it depends on env. variables)

The tarball I have fished from CRAN says version 0.2.0, but your GitHub
repo <https://github.com/asadow/megamation/> says version 0.1.0.
(For best results, help us to help you by showing the source code.) Have
you submitted this package to CRAN before? Did it previously contain a
test that ran mm_authorize(overwrite = TRUE)?

This is incredibly weird, but since your examples don't seem to run
Sys.setenv() and have never ran mm_authorize(), my only low-probability
guess is that the .Renviron changes from mm_authorize(overwrite = TRUE)
in your tests/testthat/test-authorize.R turned out to persist from the
check run of the previous version of your package.

It may be a better idea to make use of tools::R_user_dir() in
mm_authorize() and the rest of the package (and to be much more careful
when unit-testing this function: changing user files and other global
state in tests and examples is against CRAN policy) and leave
~/.Renviron for the user to edit.

> 2. I see the example printed twice with strange formatting?

This is how @examplesIf works: it wraps your code in if (condition)
withAutoprint { your code }. The first time is R echoing the source
code back; the second time is R printing every line of the
withAutoprint(...) code block before it's executed. withAutoprint helps
you see the exact line where your example fails; otherwise you'd see
the whole block of code start to execute and then fail somewhere.

-- 
Best regards,
Ivan



More information about the R-package-devel mailing list