Skip to content

Commit 395b71d

Browse files
rustyconoverclaude
andcommitted
test(fixtures): use VGI_TEST_BRANCH_DIR for native-branch scratch paths
The multi_branch_* and required_field_filter_paths_native fixtures baked `/tmp/...` parquet/csv paths into their read_parquet/read_csv branch definitions, coupled by convention to .test files that write the same hardcoded `/tmp` path. Windows has no `/tmp`, so the COPY-TO in those tests failed ("cannot find the path specified") and the whole suite leg went red. Read the shared scratch dir from `$VGI_TEST_BRANCH_DIR` (fallback: `tempfile.gettempdir()`), forward-slashed and trailing-sep-stripped so `f"{_BRANCH_DIR}/name"` matches the test's ${VGI_TEST_BRANCH_DIR}/name COPY target byte-for-byte on both platforms. The paired .test + Makefile change lives in the vgi extension repo. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 33740fe commit 395b71d

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

‎vgi/_test_fixtures/worker.py‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
_sys.exit("vgi-fixture-worker requires numpy. Install it with: pip install 'vgi-python[test-fixtures]'")
3434

35+
import os
36+
import tempfile
3537
import uuid
3638
from typing import Annotated, Any
3739

@@ -269,6 +271,14 @@
269271
from vgi.schema_utils import schema
270272
from vgi.worker import Worker
271273

274+
# Shared scratch dir for native-branch fixtures (read_parquet / read_csv arms).
275+
# The fixture below and the coupled .test files must name the SAME concrete path:
276+
# the tests reference it via ${VGI_TEST_BRANCH_DIR} and this reads the same env,
277+
# defaulting to the OS temp dir. Hardcoding /tmp broke on Windows (no /tmp). Kept
278+
# forward-slashed (DuckDB + Python both accept '/' on Windows) with no trailing
279+
# separator so f"{_BRANCH_DIR}/name" matches the test's COPY-TO target byte-for-byte.
280+
_BRANCH_DIR = (os.environ.get("VGI_TEST_BRANCH_DIR") or tempfile.gettempdir()).replace("\\", "/").rstrip("/")
281+
272282

273283
# ---------------------------------------------------------------------------
274284
# DuckDB-backed table: demonstrates statistics_from_duckdb() helper.
@@ -1453,7 +1463,7 @@ def table_scan_branches_get(
14531463
),
14541464
ScanBranch(
14551465
function_name="read_parquet",
1456-
positional_arguments=[pa.scalar("/tmp/vgi_hetero_branch.parquet", pa.string())],
1466+
positional_arguments=[pa.scalar(f"{_BRANCH_DIR}/vgi_hetero_branch.parquet", pa.string())],
14571467
named_arguments={},
14581468
),
14591469
],
@@ -1475,7 +1485,7 @@ def table_scan_branches_get(
14751485
),
14761486
ScanBranch(
14771487
function_name="iceberg_scan",
1478-
positional_arguments=[pa.scalar("/tmp/vgi_iceberg_branch", pa.string())],
1488+
positional_arguments=[pa.scalar(f"{_BRANCH_DIR}/vgi_iceberg_branch", pa.string())],
14791489
named_arguments={},
14801490
),
14811491
],
@@ -1525,7 +1535,7 @@ def table_scan_branches_get(
15251535
),
15261536
ScanBranch(
15271537
function_name="read_csv_auto",
1528-
positional_arguments=[pa.scalar("/tmp/vgi_nopushdown_branch.csv", pa.string())],
1538+
positional_arguments=[pa.scalar(f"{_BRANCH_DIR}/vgi_nopushdown_branch.csv", pa.string())],
15291539
named_arguments={},
15301540
),
15311541
],
@@ -1542,17 +1552,17 @@ def table_scan_branches_get(
15421552
branches=[
15431553
ScanBranch(
15441554
function_name="read_parquet",
1545-
positional_arguments=[pa.scalar("/tmp/vgi_recon_a_b.parquet", pa.string())],
1555+
positional_arguments=[pa.scalar(f"{_BRANCH_DIR}/vgi_recon_a_b.parquet", pa.string())],
15461556
named_arguments={},
15471557
),
15481558
ScanBranch(
15491559
function_name="read_parquet",
1550-
positional_arguments=[pa.scalar("/tmp/vgi_recon_b_a.parquet", pa.string())],
1560+
positional_arguments=[pa.scalar(f"{_BRANCH_DIR}/vgi_recon_b_a.parquet", pa.string())],
15511561
named_arguments={},
15521562
),
15531563
ScanBranch(
15541564
function_name="read_parquet",
1555-
positional_arguments=[pa.scalar("/tmp/vgi_recon_a_only.parquet", pa.string())],
1565+
positional_arguments=[pa.scalar(f"{_BRANCH_DIR}/vgi_recon_a_only.parquet", pa.string())],
15561566
named_arguments={},
15571567
),
15581568
],
@@ -1629,15 +1639,15 @@ def table_scan_function_get(
16291639
if schema_name.lower() == "data" and name.lower() == "rff_parquet":
16301640
return ScanFunctionResult(
16311641
function_name="read_parquet",
1632-
positional_arguments=[pa.scalar("/tmp/rff_seg.parquet", pa.string())],
1642+
positional_arguments=[pa.scalar(f"{_BRANCH_DIR}/rff_seg.parquet", pa.string())],
16331643
named_arguments={},
16341644
)
16351645

16361646
# rff_hive / rff_hive_mixed — native read_parquet over a Hive glob.
16371647
if schema_name.lower() == "data" and name.lower() in ("rff_hive", "rff_hive_mixed"):
16381648
return ScanFunctionResult(
16391649
function_name="read_parquet",
1640-
positional_arguments=[pa.scalar("/tmp/rff_hive/*/*/*.parquet", pa.string())],
1650+
positional_arguments=[pa.scalar(f"{_BRANCH_DIR}/rff_hive/*/*/*.parquet", pa.string())],
16411651
named_arguments={"hive_partitioning": pa.scalar(True)},
16421652
)
16431653

0 commit comments

Comments
 (0)