Skip to content

Commit 1438bd0

Browse files
committed
Use temp file infrastructure for tests
1 parent 2068658 commit 1438bd0

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tests/testthat/test-render.R

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,21 @@ test_that("metadata-file and metadata are merged in quarto_render", {
4646
)
4747
})
4848

49-
5049
test_that("`quarto_render(as_job = TRUE)` is wrapable", {
51-
skip_if(is.null(quarto_path()))
50+
skip_on_cran() # this is to test inside RStudio IDE interactively
51+
skip_if_no_quarto()
5252
skip_if_not_installed("rstudioapi")
53-
skip_if_not_installed("rprojroot")
5453
skip_if_not(rstudioapi::isAvailable())
55-
dir <- rprojroot::find_testthat_root_file()
56-
input <- file.path(dir, "test.Rmd")
57-
output <- file.path(dir, "test.html")
58-
wrapper <- function(path) quarto_render(path, quiet = TRUE, as_job = TRUE)
59-
wrapper(input)
54+
qmd <- local_qmd_file(c("content"))
55+
withr::local_dir(dirname(qmd))
56+
output <- basename(
57+
withr::local_file(xfun::with_ext(qmd, ".native"))
58+
)
59+
wrapper <- function(path, out, format) {
60+
quarto_render(path, output_file = out, output_format = format, quiet = TRUE, as_job = TRUE)
61+
}
62+
wrapper(basename(qmd), output, "native")
6063
# wait for background job to finish (10s should be conservative enough)
6164
Sys.sleep(10)
6265
expect_true(file.exists(output))
63-
unlink(output)
6466
})

0 commit comments

Comments
 (0)