Repository navigation
ci: test on Windows in PR CI and the release platform matrix - #531
Conversation
Add a test-windows job to continuous-integration.yml that runs the test suite on windows-latest (Python 3.12) for every pull request, and report its result in ci-summary. Lint, import layering, and the release build stay on the Linux validate job, which is unchanged. Add windows-latest to publish.yml's platform-matrix and run its steps under bash so the same scripts work on every runner. PyHC standard #4 asks packages to support all major operating systems. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @blalterman's task in 18s —— View job Review of PR #531: Windows CIThe change is small and sound. I read the diff and the surrounding workflow files. I did not run the workflows, so none of this is checked on a Windows runner. What's good
Suggestions (none blocking)
Security Tests No blocking issues. It's fine to merge once the Windows job passes on this PR. |
On Windows the default encoding is cp1252, so reading workflows that contain emoji raised UnicodeDecodeError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- test_commit_message_hook: resolve bash with shutil.which. A bare "bash"
makes Windows search System32 before PATH and run the WSL launcher,
which cannot open the Windows path to the message file.
- test_cache: also point USERPROFILE at the fake home. Path.home() on
Windows reads USERPROFILE and ignores HOME.
- test_elemental_abundance: compare the path to Path("C/N-OV-H") rather
than checking str(path) for a forward slash, which Windows renders as a
backslash. The path is the same on every OS.
- test_p0_contract: keep SYSTEMROOT in the python -O probe's environment,
which Windows processes need to start, and assert on the return code
with the child's stderr as the message instead of hiding it behind
check=True.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @blalterman's task in 22s —— View job Review of PR #531: Windows CII read the full diff against
What's good
Suggestions (none blocking)
Security Tests No blocking issues. It's fine to merge once |
The probe ran with a hand-built environment of PYTHONPATH and PATH (plus SYSTEMROOT after the previous fix). On Windows, Path.home() needs USERPROFILE, and astropy calls it on import, so the child failed with "RuntimeError: Could not determine home directory." Inherit os.environ and override only PYTHONPATH, so the probe still imports this checkout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @blalterman's task in 29s —— View job Review of PR #531: Windows CII read the diff of the four commits ( What's good
Suggestions (none blocking)
Security No blocking issues. It's fine to merge once |
DataLoader.age computes now() - ctime, and ctime reads now() again after looking up the cache, so age falls short by the time between the two reads. This is why test_age_is_the_time_since_the_cache_was_written failed by microseconds on Linux (7.5 us) and Windows (0.3 us). The new test fakes the clock to advance one minute per read, which makes the shortfall deterministic. Marked xfail(strict=True, raises=AgeShortError) until the fix lands. Verified: xfails as committed; with the fix applied transiently it fails as XPASS(strict); with an unrelated assert False injected it is reported FAILED, not xfailed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
age returned now() - ctime, and ctime looked up the cache and read now() again, so age fell short by the time between the two reads. age now returns the cached copy's age directly (cache.cached_age), and the time since 1970 when nothing is cached, as before. Before: test_age_does_not_depend_on_when_the_clock_is_read xfailed (AgeShortError: age one minute short under a clock advancing a minute per read). After: it passes, the xfail marker is removed, and the solar_activity tests pass (322 passed, 8 skipped). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @blalterman's task in 22s —— View job Review of PR #531: Windows CII read the diff of the six commits ( What's good
The
Suggestions (none blocking)
Security No blocking issues. It's fine to merge once |
ci-summary printed "validation failed" but always exited 0, so it showed green while validate or test-windows were red. It now exits 1 on failure. test-windows gets timeout-minutes: 30 (the suite takes about 2 minutes), so a hung test fails fast instead of running for GitHub's 6-hour default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @blalterman's task in 19s —— View job Review of PR #531: Windows CII read the workflow diff for all 7 commits. I did not run anything on a Windows runner, so the first green Addressed since the last review
Still open (none blocking)
Security Verdict |
The platform-matrix cached ~/.cache/pip, which is pip's cache only on Linux, so the cache did nothing on macOS and Windows. Use setup-python's cache: pip, which finds the right directory on each OS. Install build, setuptools_scm and wheel so tests/test_release_artifacts.py runs in the release gate instead of skipping on every OS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @blalterman's task in 26s —— View job Review of PR #531: Windows CII read the diff of all 8 commits against the merge base and the Addressed since the last review
Still open (none blocking)
Security Tests Verdict |
Adds Windows testing, per PyHC standard #4 (packages must strive to support all major operating systems).
Workflows
continuous-integration.yml: newtest-windowsjob runs the test suite onwindows-latest(Python 3.12) for every pull request, with a 30-minute timeout. The Linuxvalidatejob is unchanged, so lint, import layering, and the release build still run once, on Linux.ci-summarynow reports both jobs and exits 1 unless both succeed. Before this PR it printed "failed" but always exited 0, so it showed green while a job was red.publish.yml:platform-matrixaddswindows-latest, with run steps undershell: bashso the existing scripts work on the Windows runner. Its Windows cells run only on version tags, so they are first exercised at the next release.Test portability fixes
The package needed no changes for Windows. These failures came from tests assuming Unix behavior:
test_declared_versions.py: read workflow files as UTF-8 (Windows defaults to cp1252, which cannot decode the emoji in them).test_commit_message_hook.py: resolvebashwithshutil.which; a barebashon Windows runs the WSL launcher from System32.solar_activity/test_cache.py: setUSERPROFILEas well asHOME, sincePath.home()readsUSERPROFILEon Windows.plotting/labels/test_elemental_abundance.py: comparePathobjects instead of strings, so/and\separators match.fitfunctions/test_p0_contract.py: thepython -Oprobe inherits the environment (overriding onlyPYTHONPATH) and reports the child's stderr on failure.Package fix:
DataLoader.ageDataLoader.agereturnednow() - ctime, andctimereadnow()again after the cache lookup, soagefell short by the time between the two reads. This madetest_age_is_the_time_since_the_cache_was_writtenfail by microseconds on Linux and Windows.agenow returns the cached copy's age in one reading; with nothing cached it still returns the time since 1970. A new test fakes the clock to advance one minute per read, which makes the shortfall deterministic. It landed first asxfail(strict=True); the fix removes the marker.Release matrix
platform-matrixusessetup-python'scache: pip, which finds pip's cache on every OS; the old~/.cache/pipstep did nothing on macOS and Windows.build,setuptools_scmandwheel, sotests/test_release_artifacts.pyruns in the release gate instead of skipping. This matrix runs only on version tags, so these changes are first exercised at the next release.🤖 Generated with Claude Code