From 08745dc1e140f04b35e0d024c4c5b102c675c718 Mon Sep 17 00:00:00 2001 From: Brendan Clement Date: Tue, 2 Jun 2026 23:54:40 -0700 Subject: [PATCH] test(python): guard pylance-dependent branch tests with importorskip --- python/python/tests/test_table.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/python/python/tests/test_table.py b/python/python/tests/test_table.py index 084a077ef..b3d0f11c7 100644 --- a/python/python/tests/test_table.py +++ b/python/python/tests/test_table.py @@ -943,6 +943,9 @@ def test_branches(tmp_path): def test_branches_preserve_namespace(tmp_path): + pytest.importorskip( + "lance" + ) # namespace_path routes through lance's DirectoryNamespace db = lancedb.connect(tmp_path) table = db.create_table("t", [{"id": 1}], namespace_path=["ns1"]) assert table.namespace == ["ns1"] @@ -951,6 +954,10 @@ def test_branches_preserve_namespace(tmp_path): assert branch.namespace == ["ns1"] assert branch.id == table.id + # opening the branch directly also preserves namespace identity + opened = db.open_table("t", namespace_path=["ns1"], branch="exp") + assert opened.namespace == ["ns1"] + def test_open_table_with_branch(tmp_path): db = lancedb.connect(tmp_path) @@ -962,14 +969,9 @@ def test_open_table_with_branch(tmp_path): # opening without branch still tracks main assert db.open_table("t").count_rows() == 1 - # with a namespace, the opened branch handle preserves namespace identity - nt = db.create_table("ns_t", [{"i": 1}], namespace_path=["ns1"]) - nt.branches.create("exp") - opened = db.open_table("ns_t", namespace_path=["ns1"], branch="exp") - assert opened.namespace == ["ns1"] - def test_branch_to_lance_targets_branch(tmp_path): + pytest.importorskip("lance") db = lancedb.connect(tmp_path) table = db.create_table("t", [{"i": 1}]) branch = table.branches.create("exp")