Re: [Rd] Behavior of --install-tests and testInstalledPackage

2014-01-27 Thread Winston Chang
On Wed, Jan 22, 2014 at 10:55 AM, Brian Lee Yung Rowe r...@muxspace.comwrote:

 Hello,

 I'm writing a script that automates the testing of reverse dependencies of
 a package. I found the function testInstalledPackage in the tools package,
 which seems to do what I want. However, when I use it for a source package
 that was installed with --install-tests, I've noticed that only the actual
 test files (e.g. located in inst/tests) are available and run. In other
 words the test harness script (e.g. in tests) is not copied, so any wiring
 to run tests isn't available when running testInstalledPackage.

 I tried loading the required packages (i.e. the installed package to
 retest plus the testing frameworks RUnit, testthat), but since
 testInstalledPackage makes an external call to R CMD BATCH, any packages
 loaded in my current environment have no effect on the tests. The only
 workaround that I've come up with is to add require statements to the top
 of each test file, but this is a bit onerous.

 My question is whether
 1) there is a technique to force the test harness script (e.g.
 tests/run_tests.R, tests/doRUnit.R) to be copied into the installed source
 package, or
 2) there is a way to have testInstalledPackage force the loading of
 required packages prior to executing test scripts, or
 3) has someone already done this?



I can answer (3). devtools already has a function that does this:
  library(devtools)
  revdep_check('mypackage')

It's basically a wrapper for the revdep and check_cran functions from
devtools. In the development version of devtools (on Github) there are some
changes to improve the output of these functions.

-Winston

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Behavior of --install-tests and testInstalledPackage

2014-01-27 Thread Brian Lee Yung Rowe
Winston,

Thanks for the pointer. Hadley made the same suggestion. One thing I was 
looking to do though was have something like this automated, so it would be 
nice to have a return value instead of just results written to files. That's 
one nice thing about the testInstalledPackage function, despite the issue with 
the test harness. Any additional pointers are greatly appreciated. 

Warm Regards,
Brian Rowe

•••••
Brian Lee Yung Rowe
Founder, Zato Novo
Professor 


On Jan 27, 2014, at 12:52 PM, Winston Chang winstoncha...@gmail.com wrote:

 On Wed, Jan 22, 2014 at 10:55 AM, Brian Lee Yung Rowe r...@muxspace.com 
 wrote:
 Hello,
 
 I'm writing a script that automates the testing of reverse dependencies of a 
 package. I found the function testInstalledPackage in the tools package, 
 which seems to do what I want. However, when I use it for a source package 
 that was installed with --install-tests, I've noticed that only the actual 
 test files (e.g. located in inst/tests) are available and run. In other 
 words the test harness script (e.g. in tests) is not copied, so any wiring 
 to run tests isn't available when running testInstalledPackage.
 
 I tried loading the required packages (i.e. the installed package to retest 
 plus the testing frameworks RUnit, testthat), but since testInstalledPackage 
 makes an external call to R CMD BATCH, any packages loaded in my current 
 environment have no effect on the tests. The only workaround that I've come 
 up with is to add require statements to the top of each test file, but this 
 is a bit onerous.
 
 My question is whether
 1) there is a technique to force the test harness script (e.g. 
 tests/run_tests.R, tests/doRUnit.R) to be copied into the installed source 
 package, or
 2) there is a way to have testInstalledPackage force the loading of required 
 packages prior to executing test scripts, or
 3) has someone already done this?
 
 
 I can answer (3). devtools already has a function that does this:
   library(devtools)
   revdep_check('mypackage')
 
 It's basically a wrapper for the revdep and check_cran functions from 
 devtools. In the development version of devtools (on Github) there are some 
 changes to improve the output of these functions.
 
 -Winston 

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Behavior of --install-tests and testInstalledPackage

2014-01-22 Thread Brian Lee Yung Rowe
Hello,

I'm writing a script that automates the testing of reverse dependencies of a 
package. I found the function testInstalledPackage in the tools package, which 
seems to do what I want. However, when I use it for a source package that was 
installed with --install-tests, I've noticed that only the actual test files 
(e.g. located in inst/tests) are available and run. In other words the test 
harness script (e.g. in tests) is not copied, so any wiring to run tests isn't 
available when running testInstalledPackage. 

I tried loading the required packages (i.e. the installed package to retest 
plus the testing frameworks RUnit, testthat), but since testInstalledPackage 
makes an external call to R CMD BATCH, any packages loaded in my current 
environment have no effect on the tests. The only workaround that I've come up 
with is to add require statements to the top of each test file, but this is a 
bit onerous.

My question is whether
1) there is a technique to force the test harness script (e.g. 
tests/run_tests.R, tests/doRUnit.R) to be copied into the installed source 
package, or
2) there is a way to have testInstalledPackage force the loading of required 
packages prior to executing test scripts, or
3) has someone already done this?

Thanks and Regards,
Brian
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel