Skip to content

Commit

Permalink
rich comments
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Kusumgar committed Mar 4, 2024
1 parent f910e89 commit 8971d67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 4 additions & 5 deletions R/run.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,14 @@
##' orderly2::orderly_metadata_extract(name = "data", root = path)
orderly_run <- function(name, parameters = NULL, envir = NULL, echo = TRUE,
search_options = NULL, root = NULL, locate = TRUE) {
env_src <- Sys.getenv("ORDERLY_REPORT_SRC")
is_env_src_empty <- !nzchar(env_src)
root <- root_open(root, locate, require_orderly = is_env_src_empty,
env_root_src <- Sys.getenv("ORDERLY_SRC_ROOT", NA_character_)
root <- root_open(root, locate, require_orderly = is.na(env_root_src),
call = environment())

if (is_env_src_empty) {
if (is.na(env_root_src)) {
root_src <- root$path
} else {
root_src <- orderly_src_root(env_src, locate, call = environment())
root_src <- orderly_src_root(env_root_src, locate, call = environment())
}

name <- validate_orderly_directory(name, root_src, environment())
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-run-separate.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test_that("can run simple case in separate directory", {
info <- test_prepare_orderly_example_separate("explicit")
id <- withr::with_envvar(
c(ORDERLY_REPORT_SRC = info$src),
c(ORDERLY_SRC_ROOT = info$src),
orderly_run_quietly("explicit", envir = new.env(), root = info$outpack)
)
expect_type(id, "character")
Expand All @@ -19,7 +19,7 @@ test_that("can run shared resources case in separate directory", {
## root.
info <- test_prepare_orderly_example_separate("shared")
id <- withr::with_envvar(
c(ORDERLY_REPORT_SRC = info$src),
c(ORDERLY_SRC_ROOT = info$src),
orderly_run_quietly("shared", envir = new.env(), root = info$outpack)
)
expect_setequal(
Expand All @@ -32,11 +32,11 @@ test_that("can use dependencies in separate directory", {
## Ensures that we hit the outpack root for pulling deps in
info <- test_prepare_orderly_example_separate(c("data", "depends"))
id1 <- withr::with_envvar(
c(ORDERLY_REPORT_SRC = info$src),
c(ORDERLY_SRC_ROOT = info$src),
orderly_run_quietly("data", envir = new.env(), root = info$outpack)
)
id2 <- withr::with_envvar(
c(ORDERLY_REPORT_SRC = info$src),
c(ORDERLY_SRC_ROOT = info$src),
orderly_run_quietly("depends", envir = new.env(), root = info$outpack)
)
path1 <- file.path(info$outpack, "archive", "data", id1)
Expand All @@ -53,7 +53,7 @@ test_that("can get git information in separate directory", {
info <- test_prepare_orderly_example_separate("explicit")
info$git <- helper_add_git(info$src)
id <- withr::with_envvar(
c(ORDERLY_REPORT_SRC = info$src),
c(ORDERLY_SRC_ROOT = info$src),
orderly_run_quietly("explicit", envir = new.env(), root = info$outpack)
)
meta <- orderly_metadata(id, root = info$outpack)
Expand All @@ -66,7 +66,7 @@ test_that("can't run interactively in separate directory", {
## root
info <- test_prepare_orderly_example_separate(c("data", "depends"))
id1 <- withr::with_envvar(
c(ORDERLY_REPORT_SRC = info$src),
c(ORDERLY_SRC_ROOT = info$src),
orderly_run_quietly("data", envir = new.env(), root = info$outpack)
)
path_src <- file.path(info$src, "src", "depends")
Expand Down

0 comments on commit 8971d67

Please sign in to comment.