Skip to content

Commit

Permalink
conftest can test without torch
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyxu committed Dec 24, 2022
1 parent 854cd62 commit 9e24247
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions integration/duckdb/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@

import duckdb
import pytest
import torch

try:
import torch
has_torch = True
except ImportError:
has_torch = False


@pytest.fixture
def db() -> duckdb.DuckDBPyConnection:
"""Initialize duckdb with lance extension"""
db = duckdb.connect(config={"allow_unsigned_extensions": True})

build_dir = "cuda-build" if torch.cuda.is_available() else "manylinux-build"
build_dir = "manylinux-build"
if has_torch:
if torch.cuda.is_available():
build_dir = "cuda-build"

cur_path = Path(__file__).parent
db.install_extension(str(cur_path.parent / build_dir / "lance.duckdb_extension"), force_install=True)
Expand Down

0 comments on commit 9e24247

Please sign in to comment.