Skip to content
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

Use host system user for running tests #119

Merged
merged 6 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ jobs:

- name: Install lamindb
run: |
pip install lamindb[aws]
pip install lamindb[aws] huggingface_hub
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Koncopd, why is this necessary here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it helps but this is the error you get on the lamindata instance if it's not installed https://github.com/laminlabs/laminr/actions/runs/12065168313/job/33643383339#step:12:210

 Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: ImportError: Install huggingface_hub to access HfFileSystem

I've noticed it's only on that instance, it's not needed on cellxgene for example.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sunnyosun I'm going to merge this now because we need it for something else but if it turns out huggingface_hub isn't required later we can remove it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!


- name: Log in to Lamin
run: |
lamin login

- name: Set cellxgene as default instance
- name: Set lamindata as default instance
run: |
lamin connect laminlabs/cellxgene
lamin connect laminlabs/lamindata

- uses: r-lib/actions/setup-r-dependencies@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ jobs:

- name: Install lamindb
run: |
pip install lamindb[aws]
pip install lamindb[aws] huggingface_hub

- name: Log in to Lamin
run: |
lamin login

- name: Set cellxgene as default instance
- name: Set lamindata as default instance
run: |
lamin connect laminlabs/cellxgene
lamin connect laminlabs/lamindata

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
Expand Down
3 changes: 1 addition & 2 deletions R/settings_store.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@
}
raw_type <- field_types[[name]]

optional <- grepl("Optional\\[.*\\]", raw_type)
type <- gsub("Optional\\[(.*)\\]", "\\1", raw_type)

value <-
if (optional && raw_value == "null") {
if (raw_value == "null") {
NULL
} else if (type == "str") {
raw_value
Expand Down
42 changes: 0 additions & 42 deletions tests/testthat/helper-setup_lamindata_instance.R

This file was deleted.

7 changes: 7 additions & 0 deletions tests/testthat/helper-skip_if_not_logged_in.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
skip_if_not_logged_in <- function() {
user_settings <- .get_user_settings()
testthat::skip_if(
is.null(user_settings$access_token),
"You must be logged in to run this test"
)
}
8 changes: 4 additions & 4 deletions tests/testthat/test-Artifact.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test_that("creating an artifact from a data frame works", {
skip_if_not_installed("reticulate")
skip_if_not(reticulate::py_module_available("lamindb"))

local_setup_lamindata_instance()
skip_if_not_logged_in()

db <- connect()

Expand All @@ -25,7 +25,7 @@ test_that("creating an artifact from a file works", {
skip_if_not_installed("reticulate")
skip_if_not(reticulate::py_module_available("lamindb"))

local_setup_lamindata_instance()
skip_if_not_logged_in()

db <- connect()

Expand All @@ -45,7 +45,7 @@ test_that("creating an artifact from a directory works", {
skip_if_not_installed("reticulate")
skip_if_not(reticulate::py_module_available("lamindb"))

local_setup_lamindata_instance()
skip_if_not_logged_in()

db <- connect()

Expand All @@ -68,7 +68,7 @@ test_that("creating an artifact from an AnnData works", {
skip_if_not(reticulate::py_module_available("lamindb"))
skip_if_not_installed("anndata")

local_setup_lamindata_instance()
skip_if_not_logged_in()

db <- connect()

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-Registry.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
skip_if_offline()

test_that("df works", {
local_setup_lamindata_instance()
skip_if_not_logged_in()

db <- connect("laminlabs/lamindata")

Expand All @@ -12,7 +12,7 @@ test_that("df works", {
})

test_that("to_string works", {
local_setup_lamindata_instance()
skip_if_not_logged_in()

db <- connect("laminlabs/lamindata")

Expand All @@ -32,7 +32,7 @@ test_that("to_string works", {
})

test_that("print works", {
local_setup_lamindata_instance()
skip_if_not_logged_in()

db <- connect("laminlabs/lamindata")

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-RelatedRecords.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
skip_if_offline()

test_that("RelatedRecord methods work", {
local_setup_lamindata_instance()
skip_if_not_logged_in()

db <- connect("laminlabs/lamindata")
artifact <- db$Artifact$get("mePviem4DGM4SFzvLXf3")
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-connect_lamindata.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
skip_if_offline()

test_that("Connecting to lamindata works", {
local_setup_lamindata_instance()
skip_if_not_logged_in()

# try to connect to lamindata
db <- connect("laminlabs/lamindata")
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-instance_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ broken_instance_settings <- function() {
}

test_that("get_schema works", {
local_setup_lamindata_instance()
skip_if_not_logged_in()

instance_file <- .settings_store__instance_settings_file("laminlabs", "lamindata")
instance_settings <- .settings_load__load_instance_settings()
Expand All @@ -42,7 +42,7 @@ test_that("get_schema fails gracefully", {
})

test_that("get_record works", {
local_setup_lamindata_instance()
skip_if_not_logged_in()

instance_file <- .settings_store__instance_settings_file("laminlabs", "lamindata")
instance_settings <- .settings_load__load_instance_settings()
Expand All @@ -68,7 +68,7 @@ test_that("test get_record fails gracefully with incorrect host", {
})

test_that("get_record with select works", {
local_setup_lamindata_instance()
skip_if_not_logged_in()

instance_file <- .settings_store__instance_settings_file("laminlabs", "lamindata")
instance_settings <- .settings_load__load_instance_settings()
Expand All @@ -84,7 +84,7 @@ test_that("get_record with select works", {
})

test_that("get_record fails gracefully", {
local_setup_lamindata_instance()
skip_if_not_logged_in()

instance_file <- .settings_store__instance_settings_file("laminlabs", "lamindata")
instance_settings <- .settings_load__load_instance_settings()
Expand All @@ -106,7 +106,7 @@ test_that("get_record fails gracefully", {
})

test_that("get_records works", {
local_setup_lamindata_instance()
skip_if_not_logged_in()

instance_file <- .settings_store__instance_settings_file("laminlabs", "lamindata")
instance_settings <- .settings_load__load_instance_settings()
Expand Down
Loading