[R-pkg-devel] Cryptic error on Windows but not Debian
Adam
@@eb@@dow@k| @end|ng |rom gm@||@com
Sat Nov 18 21:39:52 CET 2023
Dear Ivan,
Thank you for explaining in such depth. I had not submitted to CRAN before.
I will look into tools::R_user_dir().
- May you point me toward the policy that the package should not edit
.Renviron? I thought I was following best practices, but maybe things have
changed. For instance, this package changes the .Renvrion GitHub -
ropensci/qualtRics: Download ⬇️ Qualtrics survey data directly into R!
<https://github.com/ropensci/qualtRics> with the difference being that they
do not use withr::defer().
- It occured to me I need skip_on_cran() for the test "mm_authorize() sets
credentials". That is because testing_key(), which refers to an env var, is
not available on CRAN. Even without testing_key(), the test
"mm_authorize() sets credentials" does not error. It gives a message
-- Skip (Line 4): mm_authorize() sets credentials ------------------------------
Reason: Can't find envvar MEGAMATION_KEY_HTTR2
but since CMD check does not print this as a NOTE, and testthat does not
print it either, I was unaware of it.
Best,
Adam
On Sat, Nov 18, 2023 at 12:35 PM Ivan Krylov <krylov.r00t using gmail.com> wrote:
> В 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
>
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list