Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
plietar committed May 31, 2024
1 parent eccfeb3 commit d18e99c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
10 changes: 2 additions & 8 deletions tests/testthat/helper-outpack.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,8 @@ outpack_packet_end_quietly <- function(...) {
}

forcibly_truncate_file <- function(path) {
permissions <- fs::file_info(path)$permissions
fs::file_chmod(path, "a+w")
file.create(path)
}

forcibly_delete_dir <- function(path) {
# On Windows, read-only files cannot be deleted.
# chmod the whole tree recursively first.
# fs::dir_walk(path, function(p) fs::file_chmod(p, "a+w"),
# all = TRUE, recurse = TRUE)
fs::dir_delete(path)
fs::file_chmod(path, permissions)
}
4 changes: 2 additions & 2 deletions tests/testthat/test-location.R
Original file line number Diff line number Diff line change
Expand Up @@ -1077,8 +1077,8 @@ test_that("can prune orphans from tree", {
test_that("don't prune referenced orphans", {
root <- create_temporary_root()
id <- create_random_packet_chain(root, 3)
forcibly_delete_dir(file.path(root$path, "archive", "a"))
forcibly_delete_dir(file.path(root$path, "archive", "c"))
fs::dir_delete(file.path(root$path, "archive", "a"))
fs::dir_delete(file.path(root$path, "archive", "c"))
suppressMessages(orderly_validate_archive(action = "orphan", root = root))
expect_equal(nrow(root$index$location(orphan)), 2)

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-run.R
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ test_that("cope with manually deleted packets, exclude from deps", {
})

id <- ids[[3]]
forcibly_delete_dir(file.path(path, "archive", "data", id))
fs::dir_delete(file.path(path, "archive", "data", id))

err <- expect_error(
orderly_run_quietly("depends", root = path, envir = new.env()),
Expand Down

0 comments on commit d18e99c

Please sign in to comment.