[R-pkg-devel] Installing "Additional" Packages During Tests

brodie gaslam brod|e@g@@|@m @end|ng |rom y@hoo@com
Mon Mar 18 17:28:43 CET 2019


 I believe your first point makes the alternate workflow below illegal, but the subsequent ones add just enough ambiguity that I'd like to makes sure.  How about:
0. Only during the running of tests
1. Create a temporary directory tmplib using tempfile()/dircreate().
2. Install dummy package to that temporary directory using `lib=tmplib`: install.packages(srcdir, type='src', repos=NULL, lib=tmplib).
3. In the tests, use library(testpkg, lib.loc=tmplib)4. unload / remove / unlink temp directory on.exit
This is only in the test running.  None of the code in the package proper that the user would invoke in normal use installs packages.  It only happens if the user installs and runs the tests, and with the above modification, it would only be into a temporary library directory.
Thank you for your patience and attention.
Best,
Brodie.


    On Monday, March 18, 2019, 11:56:55 AM EDT, Uwe Ligges <ligges using statistik.tu-dortmund.de> wrote:  
 
 1. You should never install packages without asking the user.

2. a package should never write to the user file space or default 
libraries unless the user akss for it explicitly.
In tests, use tempdir().

3. You cannot expect that the library is writeable. It is not in many 
network installations.

Best,
Uwe Ligges



On 18.03.2019 16:48, brodie gaslam via R-package-devel wrote:
> 
> Subject:
> Installing "Additional" Packages During Tests
> From:
> brodie gaslam <brodie.gaslam using yahoo.com>
> Date:
> 18.03.2019, 16:48
> To:
> List R-package-devel <r-package-devel using r-project.org>
> 
> To:
> List R-package-devel <r-package-devel using r-project.org>
> 
> 
> Sorry, previous e-mail got pre-maturely sent due to fat finger...
> My package unitizer[1] has recently gained the following type of error:
>       Warning in install.packages(pkg, repos = NULL, type = "src") :     'lib = "/home/hornik/tmp/R.check/r-devel-clang/Work/build/Packages"' is not writable
>       Error in install.packages(pkg, repos = NULL, type = "src") :
>       unable to install packages
> 
> While I did recently update the package to resolve the RNGversion issue, this problem seems unrelated as some of the CRAN machines produce it, and some don't, on the same package version.
> The tests install some dummy packages with `install.packages`, and this has worked for a long time, but no longer, presumably due to changes in permissions of the test running daemon.  The packages are removed on.exit.  The packages are used for integration tests as unitizer is a package-testing-package and it is useful to be able to test functionality that includes use on actual packages that change.
> 
> Should I expect this to be the new normal, where I will be henceforth disallowed from installing packages temporarily?  Will there be an acceptable workaround (e.g. setting up a temporary library in a tempdir and try to `install.packages` into that; I admit I have no familiarity with this other than the vague awareness maybe this could be done)?
> FWIW, perhaps an indication that this is something I shouldn't be doing came up earlier in the year when I had to resort to temporarily unsetting "R_TESTS" as per [2].
> Thanks in advance for any input.
> Best,
> Brodie.
> 
> 
> [1]: https://cran.r-project.org/web/checks/check_results_unitizer.html[2]: https://github.com/r-lib/testthat/issues/144
>     [[alternative HTML version deleted]]
> 
> 
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> 
  
	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list