Skip to content
Snippets Groups Projects
Commit 17df5622 authored by David Dorchies's avatar David Dorchies :zany_face:
Browse files

tests: clean environment after tests

parent c08fa372
No related branches found
No related tags found
No related merge requests found
Pipeline #174705 passed
...@@ -15,4 +15,5 @@ test_that("add_report should create a report", { ...@@ -15,4 +15,5 @@ test_that("add_report should create a report", {
"reports/test", "reports/test",
list.files(pkg_sys("bookdown_template"))) list.files(pkg_sys("bookdown_template")))
))) )))
unlink(path, recursive = TRUE)
}) })
...@@ -13,5 +13,6 @@ test_that("create_fairify with git = FALSE doesn't create git repo works", { ...@@ -13,5 +13,6 @@ test_that("create_fairify with git = FALSE doesn't create git repo works", {
path <- helper_create_fairify(git = FALSE) path <- helper_create_fairify(git = FALSE)
project <- basename(path) project <- basename(path)
expect_false(file.exists(file.path(path, ".git"))) expect_false(file.exists(file.path(path, ".git")))
unlink(path, recursive = TRUE)
}) })
...@@ -6,4 +6,5 @@ test_that("create_reports works", { ...@@ -6,4 +6,5 @@ test_that("create_reports works", {
expect_true(all(dir.exists(file.path(path, c("reports", "templates"))))) expect_true(all(dir.exists(file.path(path, c("reports", "templates")))))
expect_error(create_reports(path)) expect_error(create_reports(path))
expect_warning(create_reports(path, overwrite = TRUE)) expect_warning(create_reports(path, overwrite = TRUE))
unlink(path, recursive = TRUE)
}) })
...@@ -22,5 +22,5 @@ test_that("loadConfig works", { ...@@ -22,5 +22,5 @@ test_that("loadConfig works", {
expect_message(loadConfig(), expect_message(loadConfig(),
regexp = paste("Read user configuration from:", regexp = paste("Read user configuration from:",
file.path(path_pkg, "config.yml"))) file.path(path_pkg, "config.yml")))
unlink(path_pkg, recursive = TRUE)
}) })
...@@ -11,6 +11,7 @@ test_that("mermaid_gen_link: conversion of mmd to pako works", { ...@@ -11,6 +11,7 @@ test_that("mermaid_gen_link: conversion of mmd to pako works", {
f <- tempfile() f <- tempfile()
writeLines(diagram, f) writeLines(diagram, f)
expect_equal(mermaid_gen_link(f), pako) expect_equal(mermaid_gen_link(f), pako)
unlink(f)
}) })
test_that("mermaid returns a file", { test_that("mermaid returns a file", {
...@@ -26,4 +27,5 @@ test_that("mermaid returns a file", { ...@@ -26,4 +27,5 @@ test_that("mermaid returns a file", {
f <- mermaid(diagram, dir.dest = file.path(tempdir(), "try-me"), file.dest = "toto.png") f <- mermaid(diagram, dir.dest = file.path(tempdir(), "try-me"), file.dest = "toto.png")
expect_equal(f, file.path(tempdir(), "try-me", "toto.png")) expect_equal(f, file.path(tempdir(), "try-me", "toto.png"))
expect_true(file.exists(f)) expect_true(file.exists(f))
unlink(f)
}) })
skip_on_ci() skip_on_ci()
test_that("render_reports works", { test_that("render_reports works", {
path <- tempfile(pattern = "dir") path <- helper_create_fairify()
create_fairify(path, open = FALSE)
add_report("my_report", path) add_report("my_report", path)
render_reports(reports_dir = file.path(path, "reports"), render_reports(reports_dir = file.path(path, "reports"),
output_format = "bookdown::gitbook") output_format = "bookdown::gitbook")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment