-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a simple unit test which queries laminlabs/lamindata #27
Conversation
temp_lamin_dir <- tempfile() | ||
temp_lamin_dir2 <- file.path(temp_lamin_dir, ".lamin") | ||
dir.create(temp_lamin_dir2, recursive = TRUE, showWarnings = FALSE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you just use tempdir()
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No -- because tempdir()
is a temporary directory that is created once per R session, so calling tempdir()
multiple times results in the same result.
temp_lamin_dir <- tempfile() | ||
temp_lamin_dir2 <- file.path(temp_lamin_dir, ".lamin") | ||
dir.create(temp_lamin_dir2, recursive = TRUE, showWarnings = FALSE) | ||
Sys.setenv(LAMIN_SETTINGS_DIR = temp_lamin_dir) | ||
on.exit({ | ||
unlink(temp_lamin_dir, recursive = TRUE) | ||
Sys.unsetenv("LAMIN_SETTINGS_DIR") | ||
}) | ||
|
||
# generate user settings | ||
user_settings <- list( | ||
email = "null", | ||
password = "null", | ||
access_token = "null", | ||
api_key = "null", | ||
uid = "00000000", | ||
uuid = "null", | ||
handle = "anonymous", | ||
name = "null" | ||
) | ||
user_lines <- paste0("lamin_user_", names(user_settings), "=", unlist(user_settings)) | ||
writeLines(user_lines, file.path(temp_lamin_dir2, "current_user.env")) | ||
|
||
# generate instance settings | ||
instance_settings <- list( | ||
owner = "laminlabs", | ||
name = "lamindata", | ||
api_url = "https://us-east-1.api.lamin.ai", | ||
storage_root = "s3://lamindata", | ||
storage_region = "us-east-1", | ||
db = "null", | ||
schema_str = "bionty,wetlab", | ||
schema_id = "097186c3e91c01ced47aa3e01a3c1515", | ||
id = "037ba1e08d804f91a90275a47735076a", | ||
git_repo = "null", | ||
keep_artifacts_local = "False" | ||
) | ||
instance_lines <- paste0("lamindb_instance_", names(instance_settings), "=", unlist(instance_settings)) | ||
writeLines(instance_lines, file.path(temp_lamin_dir2, "current_instance.env")) | ||
writeLines(instance_lines, file.path(temp_lamin_dir2, "instance--laminlabs--lamindata.env")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In future it might make sense to make this setup into a fixture so it can be reused but probably not worth the effort now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Good idea!
Thanks for the great feedback @lazappi ! |
* origin/main: Add printing to remaining classes (#31) Improve error messages (#30) Update documentation (#29) Return `NULL` when a record's related field is empty (#28) minor fix in usage vignette (#32) Add usage vignette (#18) Add a simple unit test which queries laminlabs/lamindata (#27) bump action from v4.5.0 to v4 (#26)
Closes #7
Minor changes