From tkeitt at utexas.edu  Wed Nov 26 22:13:48 2014
From: tkeitt at utexas.edu (Tim Keitt)
Date: Wed, 26 Nov 2014 15:13:48 -0600
Subject: [Rd] testing dontrun examples
In-Reply-To: <54761FC6.3090007@gmail.com>
References: <54761FC6.3090007@gmail.com>
Message-ID: <CANnL8gp290W9QV=R02jLWLV1DSB4sM5SQW0LVzqwqO955Bezhg@mail.gmail.com>

On Wed, Nov 26, 2014 at 12:45 PM, Paul Gilbert <pgilbert902 at gmail.com>
wrote:

> Is there a good strategy for testing examples which should not be run by
> default? For instance, I have examples which get data from the Internet. If
> I wrap them in try() then they can be skipped if the Internet is not
> available, but may not be tested in cases when I would like to know about
> the failure. (Not to mention that the example syntax is ugly.)
>
> If I mark them \dontrun or \donttest then they are not tested. I could
> mark them \dontrun and then use example() but for this, in addition to
> run.dontrun=TRUE, I would need to specify all topics for a package, and I
> don't see how to do this, missing topic does not work.
>
> Wishlist: what I would really like is R CMD check --run-dontrun   pkg
>

I agree that would be nice to have.

My solution was just to have a private function (pkg:::run_examples()) that
runs all the examples. It has to be manually updated when adding a new
example however.

The devtools solution has not always worked for me when there are external
dependencies (like internet download, etc.)

THK


>
> Suggestions?
>
> Thanks,
> Paul
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
http://www.keittlab.org/

	[[alternative HTML version deleted]]



[Rd] testing dontrun examples
Tim Keitt