create_test_output_dir <- function(name = "test_immundata_") { tempfile(name) } cleanup_output_dir <- function(dir) { if (dir.exists(dir)) { unlink(dir, recursive = TRUE) } } snapshot_test_root <- function() { normalizePath(file.path(tempdir(), "imd_snap_tests"), mustWork = FALSE) } create_snapshot_test_layout <- function() { root <- snapshot_test_root() if (dir.exists(root)) { unlink(root, recursive = TRUE) } dir.create(root, recursive = TRUE, showWarnings = FALSE) project_a <- file.path(root, "projectA") project_b <- file.path(root, "projectB") dir.create(project_a, recursive = TRUE, showWarnings = FALSE) dir.create(project_b, recursive = TRUE, showWarnings = FALSE) list( root = root, projectA = project_a, projectB = project_b ) } cleanup_snapshot_test_root <- function() { keep_snap_tests <- identical(Sys.getenv("IMD_KEEP_SNAP_TESTS"), "1") if (keep_snap_tests) { return(invisible(NULL)) } root <- snapshot_test_root() if (dir.exists(root)) { unlink(root, recursive = TRUE) } } test_ig_data <- function() { system.file("extdata/ig", "multiple_ig_loci.tsv.gz", package = "immundata") }