Skip to content

Commit e16a52e

Browse files
authored
fix(test-rmd-skeletons): Fix flaky render Rmd skeleton test (#1001)
* refactor(test-rmd-skeletons): Refactor (no behavior change) * `devtools::document()` (GitHub Actions) * Resave distributed files (GitHub Action) * try to print the full error * Resave distributed files (GitHub Action) * run ci again * Resave distributed files (GitHub Action) * don't render quietly * Resave distributed files (GitHub Action) * snapshot output to capture it * Resave distributed files (GitHub Action) * I give up: `skip_on_cran()` * Resave distributed files (GitHub Action) --------- Co-authored-by: gadenbuie <gadenbuie@users.noreply.github.com>
1 parent 4673b7d commit e16a52e

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed
6.08 KB
Binary file not shown.
3.28 KB
Binary file not shown.
Binary file not shown.
Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
render_skeleton <- function(x) {
2-
tmp <- tempfile()
3-
dir.create(tmp)
4-
on.exit(unlink(tmp, recursive = TRUE), add = TRUE)
5-
src <- system.file("rmarkdown/templates", x, "skeleton/skeleton.Rmd", package = "bslib")
2+
tmp_dir <- withr::local_tempdir()
3+
tmp_rmd <- file.path(tmp_dir, "tmp.Rmd")
4+
5+
src <- system.file(
6+
"rmarkdown/templates", x, "skeleton/skeleton.Rmd",
7+
package = "bslib"
8+
)
9+
610
# Comment out bs_themer() since that needs a shiny runtime
711
txt <- sub("^bslib::bs_themer()", "#bslib::bs_themer()", readLines(src))
8-
writeLines(txt, file.path(tmp, "tmp.Rmd"))
9-
rmarkdown::render(file.path(tmp, "tmp.Rmd"), quiet = TRUE)
12+
writeLines(txt, tmp_rmd)
13+
14+
rmarkdown::render(tmp_rmd, quiet = TRUE)
1015
}
1116

1217
test_that("Rmd skeletons can be render cleanly", {
18+
skip_on_cran()
19+
1320
skip_if_not(
1421
rmarkdown::pandoc_available("1.12.3"),
1522
"Pandoc 1.12.3 or higher is required"
1623
)
17-
expect_error(render_skeleton("legacy"), NA)
18-
expect_error(render_skeleton("new"), NA)
24+
25+
expect_no_error(render_skeleton("legacy"))
26+
expect_no_error(render_skeleton("new"))
1927
withr::with_namespace(
2028
"shiny",
21-
expect_error(render_skeleton("real-time"), NA)
29+
expect_no_error(render_skeleton("real-time"))
2230
)
2331
})

0 commit comments

Comments
 (0)