Message-ID: <CABtg=K=0K5B3=xf-MJrjJtD4M1bTqTjzQb7ceHhWE4UPkN5QjA@mail.gmail.com>
Date: 2020-10-20T21:10:24Z
From: Gábor Csárdi
Subject: [R-pkg-devel] Usage of internet resources in examples
In-Reply-To: <ffd6533f-f81d-a247-b485-b20474207be5@gmail.com>
On Tue, Oct 20, 2020 at 10:07 PM Ben Bolker <bbolker at gmail.com> wrote:
>
>
>
> On 10/20/20 4:51 PM, G?bor Cs?rdi wrote:
> > On Tue, Oct 20, 2020 at 9:45 PM Ben Bolker <bbolker at gmail.com> wrote:
> > [...]
> >> if (testthat::skip_on_cran())
> >>
> >> all seem like reasonable solutions.
> >
> > I don't think you can use `testthat::skip_on_cran()` for this, it does
> > not return a logical flag:
> >
> > ? isTRUE(testthat::skip_on_cran())
> > Error: Reason: On CRAN
> >
> > It only works in testthat tests.
> >
> > Gabor
> >
> > [...]
> >
>
> oh OK, sorry. The guts of the function are (in testthat:::on_cran(),
> which can't be used because it's not exported)
>
> !identical(Sys.getenv("NOT_CRAN"), "true")
It is not really worth exporting this, because it just checks for an
environment variable, that's all it does. So all users would need to
set this environment variable to be able to run the examples. Which
does not seem like a great solution.
G.