Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

state caries between runs of devtools:: build_vignettes() #1822

Closed
JohnMount opened this issue Jul 19, 2018 · 2 comments
Closed

state caries between runs of devtools:: build_vignettes() #1822

JohnMount opened this issue Jul 19, 2018 · 2 comments

Comments

@JohnMount
Copy link

@JohnMount JohnMount commented Jul 19, 2018

State caries between runs of devtools:: build_vignettes(). This can cause a problem as side-effects of one vignette run can effect others. Below is an example where if devtools:: build_vignettes() is run in a clean environment everything is fine. However if devtools:: build_vignettes() is then re-run it errors out (due to a value assignment being left behind from the first run).

---
title: "title"
author: "author"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{example}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

Running `devtools::build_vignettes()` twice in a row with this file as a vignette errors 
out because the assignment "`ChickWeight <- NULL`" stays live between runs and then
obscures the original `datasets::ChickWeight`.

```{r}
ChickWeight <- dplyr::mutate(ChickWeight, Time = Time+1)
ChickWeight <- NULL
```
@JohnMount
Copy link
Author

@JohnMount JohnMount commented Jul 20, 2018

That was fast. Thanks!!!

Just a note: I have a vague memory that devtools::test() may or may not have a similar non-isolation issue. It didn't cause me trouble, so I didn't look into it further.

@lock
Copy link

@lock lock bot commented Jan 16, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jan 16, 2019
HughParsonage added a commit to HughParsonage/devtools that referenced this issue Jul 2, 2019
This makes the vignettes more robust / accurate

Fixes r-lib#1822
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants