Skip to content

Commit

Permalink
[chore] tidy testing environment (#106)
Browse files Browse the repository at this point in the history
* use self-cleaning temporary directories

* skip if testthis is not installed since it is not terribly common

* Apply suggestions from code review

Co-authored-by: Anna Krystalli <[email protected]>

---------

Co-authored-by: Anna Krystalli <[email protected]>
  • Loading branch information
zkamvar and annakrystalli authored Aug 13, 2024
1 parent ed3e3cf commit 172091c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/testthat/test-validate_pr.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
test_that("validate_pr works on valid PR", {
skip_if_offline()

temp_hub <- fs::path(tempdir(), "valid_sb_hub")
dir <- withr::local_tempdir()
temp_hub <- fs::dir_create(fs::path(dir, "valid_sb_hub"))
gert::git_clone(
url = "https://github.com/hubverse-org/ci-testhub-simple",
path = temp_hub,
Expand All @@ -27,7 +28,8 @@ test_that("validate_pr works on valid PR", {
test_that("validate_pr works on invalid PR", {
skip_if_offline()

temp_hub <- fs::path(tempdir(), "invalid_sb_hub")
dir <- withr::local_tempdir()
temp_hub <- fs::dir_create(fs::path(dir, "invalid_sb_hub"))
gert::git_clone(
url = "https://github.com/hubverse-org/ci-testhub-simple",
path = temp_hub,
Expand All @@ -53,7 +55,8 @@ test_that("validate_pr works on invalid PR", {
test_that("validate_pr flags modifications and deletions in PR", {
skip_if_offline()

temp_hub <- fs::path(tempdir(), "mod_del_hub")
dir <- withr::local_tempdir()
temp_hub <- fs::dir_create(fs::path(dir, "mod_del_hub"))
gert::git_clone(
url = "https://github.com/hubverse-org/ci-testhub-simple",
path = temp_hub,
Expand Down Expand Up @@ -140,7 +143,8 @@ test_that("validate_pr flags modifications and deletions in PR", {
test_that("validate_pr handles errors in determining submission window & file renaming", {
skip_if_offline()

temp_hub <- fs::path(tempdir(), "mod_exec_error_hub")
dir <- withr::local_tempdir()
temp_hub <- fs::dir_create(fs::path(dir, "mod_exec_error_hub"))
gert::git_clone(
url = "https://github.com/hubverse-org/ci-testhub-simple",
path = temp_hub,
Expand All @@ -165,7 +169,8 @@ test_that("validate_pr handles errors in determining submission window & file re
test_that("validate_pr works on valid PR using v2.0.0 schema and old orgname", {
skip_if_offline()

temp_hub <- fs::path(tempdir(), "valid_sb_hub-old")
dir <- withr::local_tempdir()
temp_hub <- fs::dir_create(fs::path(dir, "valid_sb_hub-old"))
gert::git_clone(
url = "https://github.com/hubverse-org/ci-testhub-simple-old-orgname",
path = temp_hub,
Expand Down

0 comments on commit 172091c

Please sign in to comment.