Test initialization in empty s3 bucket#
import lamindb_setup as ln_setup
from lamindb_setup.core.upath import UPath
root_str = "s3://lamindb-setup-ci-empty-bucket"
root_path = UPath(root_str, cache_regions=True)
for s in root_path.iterdir():
if s.is_file():
s.unlink()
elif s.is_dir():
s.rmdir()
assert list(root_path.iterdir()) == []
ln_setup.init(storage=root_str)
assert ln_setup.settings.storage.is_cloud
assert ln_setup.settings.storage.root_as_str == root_str
assert ln_setup.settings.storage.region == "us-east-1"
assert (
str(ln_setup.settings.instance._sqlite_file)
== f"{root_str}/{ln_setup.settings.instance.id.hex}.lndb"
)
ln_setup.delete("lamindb-setup-ci-empty-bucket", force=True)
for s in root_path.iterdir():
if s.is_file():
s.unlink()
elif s.is_dir():
s.rmdir()