-
Notifications
You must be signed in to change notification settings - Fork 993
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
Fails on CRAN due to setwd() to read-only installation directory #2546
Comments
I think this would be a solution if ("package:ggplot2" %in% search() && requireNamespace("grDevices", quietly = TRUE)) {
# Issue #2546: printing plots implicitly writes to a pdf. Unless it's
# made explicit, it's written to the working directory, which may not
# be writeable.
provide_pdf <- function() tempfile(fileext = ".pdf")
library(grDevices)
ggplot.pdf <- provide_pdf()
pdf(ggplot.pdf)
# ... <ggplot2 tests>
invisible(dev.off())
invisible(file.remove(ggplot.pdf))
} I believe only one call to I can add it to my open pull request #2545 (as I've already modified test |
Something to keep in mind -- with enough tests adding to the temporary pdf, of course the file size can be an issue. I don't know what the space allocation is on CRAN, and it would probably take hundreds of |
@HughParsonage More robust (I'm currently thinking) to not |
Current errors on CRAN including R-patched (so it's not R-devel) pasted below.
Thanks to Kurt's investigation, it's due to data.table calling
setwd()
to installation directory to reach test files loaded byfread
. But the installation directory is (very reasonably) now mounted read-only on CRAN and a write of the plot in non-interactive mode is failing for the ggplot2 compatibility tests.To reproduce: install data.table, change install directory to read-only,
library(data.table)
,library(ggplot2)
,test.data.table()
(I didn't yet try that, but in theory that should reproduce it).One solution is to stop using
setwd()
to avoid any accidental or superfluous writes there. But then allfread
tests loading test files need to be changed somehow, prefixed with the location.The text was updated successfully, but these errors were encountered: