Skip to content

Commit

Permalink
different folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Koncopd committed Aug 22, 2024
1 parent 7b520e7 commit 8a82865
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
8 changes: 4 additions & 4 deletions tests/core/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def pytest_sessionstart():
ln_setup._TESTING = True
pgurl = setup_local_test_postgres()
ln.setup.init(
storage="./default_storage",
storage="./default_storage_core",
schema="bionty",
name="lamindb-unit-tests-core",
db=pgurl,
Expand All @@ -30,7 +30,7 @@ def pytest_sessionstart():

def pytest_sessionfinish(session: pytest.Session):
logger.set_verbosity(1)
shutil.rmtree("./default_storage")
shutil.rmtree("./default_storage_core")
# handle below better in the future
if ln.UPath("s3://lamindb-test/core/.lamindb").exists():
ln.UPath("s3://lamindb-test/core/.lamindb").rmdir()
Expand All @@ -44,8 +44,8 @@ def pytest_sessionfinish(session: pytest.Session):
scope="module",
params=[
# tuple of is_in_registered_storage, path, suffix, hash of test_dir
(True, "./default_storage/", ".csv", "iGtHiFEBV3r1_TFovdQCgw"),
(True, "./default_storage/", "", "iGtHiFEBV3r1_TFovdQCgw"),
(True, "./default_storage_core/", ".csv", "iGtHiFEBV3r1_TFovdQCgw"),
(True, "./default_storage_core/", "", "iGtHiFEBV3r1_TFovdQCgw"),
(True, "./registered_storage/", ".csv", "iGtHiFEBV3r1_TFovdQCgw"),
(True, "./registered_storage/", "", "iGtHiFEBV3r1_TFovdQCgw"),
(False, "./nonregistered_storage/", ".csv", "iGtHiFEBV3r1_TFovdQCgw"),
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ def switch_storage():
cloud_storage = "s3://lamindb-ci/lamindb-unit-tests-cloud"
set_managed_storage(cloud_storage)
yield cloud_storage
set_managed_storage("./default_storage")
set_managed_storage("./default_storage_core")


def test_local_cache():
# check that we have local storage
local_storage = Path("./default_storage").resolve().as_posix()
local_storage = Path("./default_storage_core").resolve().as_posix()
assert ln.setup.settings.storage.root_as_str == local_storage

test_file = ln.core.datasets.anndata_file_pbmc68k_test()
Expand Down
8 changes: 4 additions & 4 deletions tests/core/test_label_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

@pytest.fixture
def get_test_artifacts():
with open("./default_storage/test-inherit1", "w") as f:
with open("./default_storage_core/test-inherit1", "w") as f:
f.write("artifact1")
with open("./default_storage/test-inherit2", "w") as f:
with open("./default_storage_core/test-inherit2", "w") as f:
f.write("artifact2")
artifact1 = ln.Artifact("./default_storage/test-inherit1")
artifact1 = ln.Artifact("./default_storage_core/test-inherit1")
artifact1.save()
artifact2 = ln.Artifact("./default_storage/test-inherit2")
artifact2 = ln.Artifact("./default_storage_core/test-inherit2")
artifact2.save()
yield artifact1, artifact2
artifact1.delete(permanent=True, storage=True)
Expand Down
6 changes: 4 additions & 2 deletions tests/core/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@


def test_settings_switch_storage():
assert ln.settings.storage.root.resolve() == Path("./default_storage").resolve()
assert (
ln.settings.storage.root.resolve() == Path("./default_storage_core").resolve()
)
new_storage_location = "s3://lamindb-ci/test-settings-switch-storage"
ln.settings.storage = new_storage_location
assert ln.setup.settings.storage.type_is_cloud
Expand All @@ -16,4 +18,4 @@ def test_settings_switch_storage():
assert not ln.setup.settings.storage.root.fs.cache_regions
assert ln.Storage.filter(root=new_storage_location).one_or_none() is not None
# switch back to default storage
ln.settings.storage = "./default_storage"
ln.settings.storage = "./default_storage_core"
4 changes: 2 additions & 2 deletions tests/storage/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def pytest_sessionstart():
ln_setup._TESTING = True
pgurl = setup_local_test_postgres()
ln.setup.init(
storage="./default_storage",
storage="./default_storage_storage",
name="lamindb-unit-tests-storage",
db=pgurl,
)
Expand All @@ -25,7 +25,7 @@ def pytest_sessionstart():

def pytest_sessionfinish(session: pytest.Session):
logger.set_verbosity(1)
shutil.rmtree("./default_storage")
shutil.rmtree("./default_storage_storage")
# handle below better in the future
if ln.UPath("s3://lamindb-test/storage/.lamindb").exists():
ln.UPath("s3://lamindb-test/storage/.lamindb").rmdir()
Expand Down

0 comments on commit 8a82865

Please sign in to comment.