Spaces:
Running
Running
File size: 1,063 Bytes
8429e5e 943ec7e 8429e5e 943ec7e 8429e5e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | """Shared fixtures for the gazet test suite."""
import os
from pathlib import Path
import duckdb
import pytest
# Force data dir to project root for tests
os.environ["GAZET_DATA_DIR"] = str(Path(__file__).resolve().parent.parent / "data")
# Prefer original (non-normalized) paths — test suite ships without normalized copies
os.environ["GAZET_USE_NORMALIZED_DATA"] = "0"
# ---------------------------------------------------------------------------
# DuckDB connection fixture
# ---------------------------------------------------------------------------
@pytest.fixture(scope="module")
def con():
"""Provide a DuckDB connection with the spatial extension loaded.
Module-scoped so INSTALL/LOAD spatial happens once per test file
instead of on every individual test."""
c = duckdb.connect()
c.execute("INSTALL spatial")
c.execute("LOAD spatial")
yield c
c.close()
@pytest.fixture()
def con_no_spatial():
"""Provide a bare DuckDB connection (no spatial extension)."""
c = duckdb.connect()
yield c
c.close()
|