[R-pkg-devel] [External] Re: toy example for testing purpose
Uwe Ligges
||gge@ @end|ng |rom @t@t|@t|k@tu-dortmund@de
Wed Aug 17 16:58:43 CEST 2022
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 using statistik.tu-dortmund.de>
> *Date: *Wednesday, August 17, 2022 at 10:46 AM
> *To: *Zhang, Xueqiong <joan.zhang using emory.edu>,
> r-package-devel using r-project.org <r-package-devel using 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.
> >
>
More information about the R-package-devel
mailing list