[R-pkg-devel] CRAN packages suggesting other packages but not using them conditionally

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Sat Dec 12 23:50:51 CET 2020


On 12/12/2020 4:08 p.m., Spencer Graves wrote:
> Hi, Ben et al.:
> 
> 
> On 2020-12-12 13:43, Ben Bolker wrote:
>>     Apologies if I'm telling you something you already know:
>>
>>     By default, fda::CRAN() uses the presence of environment variables
>> matched by the regexp "^_R_" as a heuristic to decide whether it's being
>> running on CRAN.
>>
>>     testthat::skip_on_cran()  calls testthat::on_cran() to look for an
>> environment variable called NOT_CRAN equal to "true". The
>> devtools::check() machinery automatically sets this variable.
> 
> 
>   > testthat::on_cran
> Error: 'on_cran' is not an exported object from 'namespace:testthat'
> 
> 
> 	  Besides, on my Mac, I get:
> 
> 
>   > testthat:::on_cran()
> [1] TRUE
> 
> 
> 	  My Mac is NOT CRAN, and I don't want that function to return TRUE on
> my computer unless I explicitly run "R CMD check --on-cran".
> 
> 
>>     So: fda::CRAN() depends on breakable assumptions, defaults to FALSE
>> in an empty environment.  skip_on_cran() defaults to TRUE in an empty
>> environment (but defaults to FALSE in a devtools::check() environment).
> 
> 	  If future changes break fda::CRAN, I will have to deal with it then.
> 
> 
> 	  I'd be happier if the CRAN maintainers would develop a procedure to
> make it easier for package maintainers do two things:
> 
> 
> 		    * Include tests in their package that run longer than the time
> limit permitted on CRAN.

That's very easy now.  Just put them in a "slowtests" directory, and 
tell R CMD check to use that.  How could it be easier?

Duncan Murdoch



More information about the R-package-devel mailing list