File tree Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -317,6 +317,21 @@ local_clean_state <- function(env = parent.frame()) {
317317 )
318318}
319319
320+ local_clean_dot_quarto <- function (where = " ." , env = parent.frame()) {
321+ skip_if_not_installed(" withr" )
322+ skip_if_not_installed(" fs" )
323+ withr :: defer(
324+ {
325+ # clean up internal .quarto directory
326+ dot_quarto <- fs :: path(where , " .quarto" )
327+ if (fs :: dir_exists(dot_quarto )) {
328+ fs :: dir_delete(dot_quarto )
329+ }
330+ },
331+ envir = env
332+ )
333+ }
334+
320335resources_path <- function (... ) {
321336 test_path(" resources" , ... )
322337}
Original file line number Diff line number Diff line change @@ -10,13 +10,17 @@ test_that("Documents can be inspected", {
1010
1111test_that(" Quarto projects can be inspected" , {
1212 skip_if_no_quarto()
13- metadata <- quarto_inspect(test_path(" project" ))
13+ project_path <- test_path(" project" )
14+ local_clean_dot_quarto(project_path )
15+ metadata <- quarto_inspect(project_path )
1416 expect_type(metadata $ config , " list" )
1517})
1618
1719test_that(" Quarto projects can be inspected with profile" , {
1820 skip_if_no_quarto()
19- metadata <- quarto_inspect(test_path(" project" ), " test" )
21+ project_path <- test_path(" project" )
22+ local_clean_dot_quarto(project_path )
23+ metadata <- quarto_inspect(project_path , " test" )
2024 expect_type(metadata $ config , " list" )
2125 expect_identical(metadata $ config $ execute $ echo , TRUE )
2226})
Original file line number Diff line number Diff line change @@ -18,17 +18,15 @@ resource_dir <- function(input) {
1818
1919local_render_theme_file <- function (input , env = parent.frame()) {
2020 skip_if_not_installed(" withr" )
21+ skip_if_not_installed(" fs" )
22+ local_clean_dot_quarto(where = dirname(input ), env = env )
2123 withr :: defer(
2224 {
2325 # clean up output resource directory
2426 out_dir <- resource_dir(input )
2527 if (fs :: dir_exists(out_dir )) {
2628 fs :: dir_delete(out_dir )
2729 }
28- # clean up internal .quarto directory
29- if (fs :: dir_exists(" .quarto" )) {
30- fs :: dir_delete(" .quarto" )
31- }
3230 },
3331 envir = env
3432 )
You can’t perform that action at this time.
0 commit comments