From dccca964939abf40275158d2a1820958d1fc324d Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Wed, 31 Jul 2024 19:39:36 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9E=96=20Remove=20bionty=20&=20lamindb=20fro?= =?UTF-8?q?m=20dependencies=20(#408)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🔥 Remove bionty from dependencies * ✏️ Typo * 💚 Fix dependency * 💚 Global fixture * 🔥 Remove unnecessary duplication * 💚 Fix --- noxfile.py | 2 +- tests/conftest.py | 9 +++++++++ tests/test_integrity.py | 11 ++--------- tests/test_models.py | 26 ++++++-------------------- 4 files changed, 18 insertions(+), 30 deletions(-) create mode 100644 tests/conftest.py diff --git a/noxfile.py b/noxfile.py index ebcd68e9..b161ed1c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -14,6 +14,6 @@ def test(session: nox.Session) -> None: run(session, "uv pip install --system -e .[dev]") run( session, - "uv pip install --system lamindb[bionty]@git+https://github.com/laminlabs/lamindb", + "uv pip install --system lamindb_setup@git+https://github.com/laminlabs/lamindb-setup", ) run_pytest(session, coverage=False) diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 00000000..5126b2ce --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,9 @@ +import lamindb_setup as ln_setup +import pytest + + +@pytest.fixture(scope="session") +def setup_instance(): + ln_setup.init(storage="./testdb") + yield + ln_setup.delete("testdb", force=True) diff --git a/tests/test_integrity.py b/tests/test_integrity.py index 259b46a5..ba5a6434 100644 --- a/tests/test_integrity.py +++ b/tests/test_integrity.py @@ -2,16 +2,9 @@ import pytest -@pytest.fixture(scope="module") -def setup_bionty_instance(): - ln_setup.init(storage="./test-bionty-db", schema="bionty") - yield - ln_setup.delete("test-bionty-db", force=True) - - -def test_migrate_check(setup_bionty_instance): +def test_migrate_check(setup_instance): assert ln_setup.migrate.check() -def test_system_check(setup_bionty_instance): +def test_system_check(setup_instance): ln_setup.django("check") diff --git a/tests/test_models.py b/tests/test_models.py index e78c705d..7cb164a1 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,8 +1,6 @@ import re import textwrap -import lamindb as ln - # The tests defined in this script use the lamindb instance defined in test_integrity @@ -12,7 +10,9 @@ def _strip_ansi(text: str) -> str: return ansi_escape.sub("", text) -def test_registry__repr__param(): +def test_registry__repr__param(setup_instance): + import lnschema_core.models as ln + param = ln.Param expected_repr = textwrap.dedent("""\ Param @@ -33,7 +33,9 @@ def test_registry__repr__param(): assert actual_repr.strip() == expected_repr.strip() -def test_registry__repr__artifact(): +def test_registry__repr__artifact(setup_instance): + import lnschema_core.models as ln + artifact = ln.Artifact expected_repr = textwrap.dedent("""\ Artifact @@ -72,22 +74,6 @@ def test_registry__repr__artifact(): .environment_of: Run .collection: Collection .collections: Collection - Bionty fields - .organisms: bionty.Organism - .genes: bionty.Gene - .proteins: bionty.Protein - .cell_markers: bionty.CellMarker - .tissues: bionty.Tissue - .cell_types: bionty.CellType - .diseases: bionty.Disease - .cell_lines: bionty.CellLine - .phenotypes: bionty.Phenotype - .pathways: bionty.Pathway - .experimental_factors: bionty.ExperimentalFactor - .developmental_stages: bionty.DevelopmentalStage - .ethnicities: bionty.Ethnicity - .reference_of_source: bionty.Source - .reference_of_sources: bionty.Source """).strip() actual_repr = _strip_ansi(repr(artifact))