-
Notifications
You must be signed in to change notification settings - Fork 20
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
Blank Rplots.pdf
generated when running snapshot tests interactively from RStudio
#227
Comments
The culprit is in these two places where Line 56 in 307c112
Lines 110 to 115 in 307c112
By replacing them both with a constant number, the problem goes away. Looks like by calling these functions in graphics, a PDF device is somehow triggered when running the tests in RStudio interactively. |
This unit test using r2rtf/tests/testthat/test-independent-testing-rtf_strwidth.R Lines 18 to 30 in 307c112
|
It seems it only happens while running unit test. I did not see the Guess a graphic device is initiated when I am OK to live with it. |
I should have been clearer - this only happens when you click the "Run Tests" button above the code editor or the "Test" button in the Build panel in RStudio, but not when you send the code into the R console. Regardless, I'd say it will be productive to get this fixed, because every package that have tests with underlying code using r2rtf will get this unavoidable side effect - and it can be confusing and annoying. For example, see previous discussions: |
To reproduce the issue:
Run
usethis::use_r("myfun")
and put this function into it:Run
usethis::use_test("myfun")
to create this test:Run
devtools::document()
anddevtools::load_all()
.Clicking the "Run Tests" button or the "Test" button in the Build panel in RStudio will generate a blank, redundant
tests/testthat/Rplots.pdf
, while no suchRplots.pdf
is generated when runningdevtools::test()
ordevtools::test_active_file()
in the R console.Reproduced under macOS, Windows, and Posit Cloud.
The text was updated successfully, but these errors were encountered: