jacobbien / litr-project

Writing R Packages with Literate Programming

Home Page:https://jacobbien.github.io/litr-project/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix testing of litr to ensure proper version is being tested

jacobbien opened this issue · comments

In most litr tests, we call render() on a template .Rmd file. However, if we have used rmarkdown::draft([...], package="litr"), the file retrieved will be from an old version of the package (namely the installed version of litr's template) rather than the latest version. Furthermore, this template .Rmd file has calls to litr::setup() and litr::document(). When these are called in the knitting process, it will be the versions of the functions from the currently installed litr rather than the versions that we are trying to test. In short, I don't think the current tests are testing the right thing!

There are multiple approaches to addressing this, but I think the most straightforward will be to use eval=FALSE in those testing code chunks (i.e., don't test along the way). Instead, at the end of create-litr.Rmd, we can install the new version and then run devtools::test(). At the end of this process we should reinstall the previous version of litr so that we don't get confused and start using a more recent version of litr as we make changes to create-litr.Rmd.

This is addressed in commit aba247f