Skip to content

Commit 88cd633

Browse files
wmaynerclaude
andcommitted
Fix the Windows and free-threaded CI lanes
Five environment-specific failures, none of them in the computation: - The precision lint read pyphi sources without an encoding, so Windows decoded them as cp1252 and failed on the first non-ASCII byte. - The import-writes-no-log test built a minimal subprocess environment; without SystemRoot, Windows cannot initialize sockets and `import asyncio` raises WinError 10106. Inherit the environment instead. - The campaign tests asserted an executable bit and ran run_task.sh through bash, neither of which exists on Windows. - Escalating every warning to an error turns a dependency's stale escape sequence into a SyntaxError the first time its source is compiled, which aborts conftest under Python 3.14 (POT). Keep SyntaxWarning visible but non-fatal; ruff's W605 covers pyphi's own sources. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019TyrR7G1d7xR6ZK9i92MtF
1 parent 4eddb4e commit 88cd633

5 files changed

Lines changed: 16 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ filterwarnings = [
280280
# reused as a zombie and the next parallel test deadlocks in
281281
# `future.result()`. Keep it a visible warning, never an error.
282282
"default:A worker stopped while some jobs were given to the executor:UserWarning",
283+
# Emitted by the compiler, so escalating it turns any dependency's stale
284+
# escape sequence into a SyntaxError the first time its source is compiled
285+
# (POT 0.9.6 under Python 3.14 aborts conftest this way). PyPhi's own
286+
# sources are covered by ruff's W605.
287+
"default::SyntaxWarning",
283288
]
284289

285290
[tool.coverage.run]

test/campaign/test_prepare.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import os
23

34
import pytest
45

@@ -25,7 +26,8 @@ def test_prepare_writes_campaign_directory(tmp_path):
2526
assert task.kind == "sweep_cells"
2627
assert task.skip_uncomputable is True
2728
assert (directory / "outputs").is_dir()
28-
assert (directory / "run_task.sh").stat().st_mode & 0o111
29+
if os.name == "posix": # Windows has no executable bit to set
30+
assert (directory / "run_task.sh").stat().st_mode & 0o111
2931
submit = (directory / "pyphi.sub").read_text()
3032
assert "queue task_id, memory from remaining.txt" in submit
3133
assert "container_image" in submit

test/campaign/test_prepare_ces.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import os
23

34
import pytest
45

@@ -442,6 +443,9 @@ def _emulate_condor_transfer(campaign_dir, scratch, inputs, preserve: bool):
442443
shutil.copy2(src, dest)
443444

444445

446+
@pytest.mark.skipif(
447+
os.name != "posix", reason="run_task.sh needs a POSIX shell and HTCondor is Linux"
448+
)
445449
def test_condor_transfer_sandbox_end_to_end(tmp_path):
446450
"""Run every job of a prepared campaign inside a sandbox that emulates
447451
HTCondor's file transfer for the generated submit file — transfer the

test/test_logging.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ def test_import_writes_no_log_file(tmp_path):
7777
import subprocess
7878
import sys
7979

80-
env = {"PYPHI_WELCOME_OFF": "1", "PATH": os.environ["PATH"]}
80+
# Inherit the environment: a hand-built one drops the variables Windows
81+
# needs to initialize sockets, and `import asyncio` then fails.
82+
env = os.environ | {"PYPHI_WELCOME_OFF": "1"}
8183
subprocess.run(
8284
[sys.executable, "-c", "import pyphi"],
8385
cwd=tmp_path,

test/test_precision_lint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _waived(lines: list[str], lineno: int) -> bool:
4545

4646

4747
def _violations(path: Path) -> list[str]:
48-
source = path.read_text()
48+
source = path.read_text(encoding="utf-8")
4949
lines = source.splitlines()
5050
tree = ast.parse(source)
5151
found = []

0 commit comments

Comments
 (0)