Skip to content
Back to formatted view

Raw Message

Message-ID: <11e78f23-944a-a582-c1eb-3bb0559c6715@statistik.tu-dortmund.de>
Date: 2022-08-17T14:58:43Z
From: Uwe Ligges
Subject: [R-pkg-devel] [External] Re: toy example for testing purpose
In-Reply-To: <BN8PR05MB59537753992CCC82FF3747AC926A9@BN8PR05MB5953.namprd05.prod.outlook.com>

On 17.08.2022 16:51, Zhang, Xueqiong wrote:
> Hi Dr Ligges and team,
> 
> Thanks for the explanation. it makes sense to me now!
> I am working on putting examples in testthat folder, hope it?s the right 
> way to do it.

Writing R Extensions well explains how to use the tests directory.
testthat is a contributed package which its own documentation.

Best,
Uwe Ligges




> /Joan Zhang, MS/
> Research Informatics Analyst
> 
> Larsen Lab - Emory Transplant Center
> 
> *From: *Uwe Ligges <ligges at statistik.tu-dortmund.de>
> *Date: *Wednesday, August 17, 2022 at 10:46 AM
> *To: *Zhang, Xueqiong <joan.zhang at emory.edu>, 
> r-package-devel at r-project.org <r-package-devel at r-project.org>
> *Subject: *[External] Re: toy example for testing purpose
> 
> 
> 
> On 16.08.2022 20:28, Zhang, Xueqiong wrote:
>  > Hi all,
>  >
>  >? ? I got this comment from our CRAN package reviewer ( blue content
>  > below) , but I am not sure how to fix it ?
>  >
>  >? ?If I put @example in source .R with \donttest then I lose the example
>  > run; if without \donttest then the CPU time will exceed 5 sec. ?I
>  > already do have examples in vignettes. ?Do I need add test calls in
>  > other place/script?
> 
> Well, ideally you have short examples so that users see quickly how your
> function can be called. Ideally examples take less than 5 sec., becuase
> users are typically not very patient when runningn exmaples from help pages.
> 
> If your examples are lengthy we ask you to put them in \donttest{} but
> try to provide short ones in addition to the lengthy ones (rather
> provide some tiny toy data, use few iterations etc)
> 
> If all ends up in \donttest{}, no vignette runtime code and no tests,
> your packages won't have any code executed at runtime which is of course
> a vey bad idea. SAo we ask to provide tests in case you do not provide
> examples that get auto-executed during the checks.
> In vignettes we typically see a workflow tested, but not all
> functionality of the package, and frequently only subseta of provided
> functions get executed in vignettes...
> 
> Best,
> Uwe Ligges
> 
> 
> 
> 
> 
> 
> 
>  > Thanks,
>  >
>  > Joan
>  >
>  > /
>  > />>>>>>>>>>>>>>>>>>>>>>>>>
>  >
>  >
>  >
>  > Putting the lengthy examples in \donttest is correct. However, it would
>  > be great if you either could write shorter toy examples or if not
>  > possible at least write some test so that we can check the functionality
>  > of your functions.
>  >
>