Skip to content

Commit 36023f5

Browse files
committed
Fix Windows corpus transport and CI test dependencies
1 parent 65a25b8 commit 36023f5

4 files changed

Lines changed: 39 additions & 6 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,18 @@ jobs:
108108
id: build_non_windows
109109
run: pip install -e . --group test
110110

111+
- name: Install Arrow dictionary test dependency
112+
# Pandas is already a dev dependency; Arrow's dictionary conversions now
113+
# import it even when the test does not construct a pandas object.
114+
run: python -m pip install pandas
115+
111116
# Build isolation uses NumPy 2 headers for the dual-ABI extension. Optional
112117
# test dependencies may upgrade the runtime too, so pin it AFTER installing.
113118
- name: Install NumPy 1.26-compatible test runtime
114119
if: matrix.numpy-version == '1.26'
115-
run: pip install "numpy==1.26.*" "zarr>=3.1.5,<3.2"
120+
# PyArrow 26 dropped the NumPy 1 ABI without encoding it in Requires-Dist.
121+
# Keep this host-compatibility job on a known dual-ABI Arrow release.
122+
run: pip install "numpy==1.26.*" "zarr>=3.1.5,<3.2" "pyarrow==21.0.0" pandas
116123

117124
- name: Verify requested NumPy runtime
118125
if: matrix.numpy-version

‎.github/workflows/menudet-paired.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ jobs:
7474
if: runner.os != 'Windows'
7575
env:
7676
MENUDET_REQUIRE_JIT: '1'
77-
run: python -m pytest tests/test_menudet_jit.py -q -n 0
77+
ME_DSL_TRACE: '1'
78+
run: |
79+
set -o pipefail
80+
python -m pytest tests/test_menudet_jit.py -q -n 0 2>&1 | tee menudet-jit.log
7881
- name: Record exact paired revisions
7982
if: always()
8083
run: |
@@ -87,3 +90,4 @@ jobs:
8790
path: |
8891
paired-revisions.txt
8992
native-build/Testing/Temporary/LastTest.log
93+
menudet-jit.log

‎tests/test_menudet_conformance.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import subprocess
77
from pathlib import Path
8+
from types import SimpleNamespace
89

910
import numpy as np
1011
import pytest
@@ -88,6 +89,25 @@ def test_platform_qualified_reference_is_exact(machine, key, monkeypatch):
8889
compat.reference_expected(case)
8990

9091

92+
def test_native_input_is_closed_before_subprocess(monkeypatch, tmp_path):
93+
case = compat.make_case("closed-input", "identity", "x", [np.array([1.0])])
94+
corpus = {"schema_version": compat.VERSION, "cases": [case]}
95+
row = {"id": case["id"], "outcome": "matching"}
96+
paths = []
97+
98+
def run(command, **kwargs):
99+
path = Path(command[1])
100+
assert json.loads(path.read_text()) == corpus
101+
# Windows permits this only after the writer closes its handle.
102+
path.unlink()
103+
paths.append(path)
104+
return SimpleNamespace(returncode=0, stdout=json.dumps(row), stderr="")
105+
106+
monkeypatch.setattr(compat.subprocess, "run", run)
107+
assert compat.native(corpus, tmp_path / "runner", tmp_path) == [row]
108+
assert not paths[0].parent.exists()
109+
110+
91111
def test_seeded_generator_and_minimization():
92112
assert compat.property_cases(1729) == compat.property_cases(1729)
93113
failure = compat.property_cases(1729)[-1]

‎tools/menudet_conformance.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,12 @@ def integrate(corpus, jit=False): # noqa: C901 -- paired execution, diagnostics
573573

574574
def native(corpus, runner, work_dir, jit=False, observe=False):
575575
validate(corpus)
576-
with tempfile.NamedTemporaryFile(mode="w", suffix=".json", dir=work_dir) as file:
577-
json.dump(corpus, file)
578-
file.flush()
579-
command = [str(runner.resolve()), file.name, "on" if jit else "off"] + (
576+
# Close the input before launching the native reader. Windows cannot reopen
577+
# a live NamedTemporaryFile with its default delete/share mode.
578+
with tempfile.TemporaryDirectory(dir=work_dir) as directory:
579+
path = Path(directory) / "corpus.json"
580+
path.write_text(json.dumps(corpus))
581+
command = [str(runner.resolve()), str(path), "on" if jit else "off"] + (
580582
["observe"] if observe else []
581583
)
582584
proc = subprocess.run(command, capture_output=True, text=True, check=False)

0 commit comments

Comments
 (0)