Skip to content

test: write test output to tmp_path, untrack generated FITS artifacts - #495

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/untrack-fits-test-artifacts
Aug 27, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/untrack-fits-test-artifacts

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

test_autoarray wrote test output into tracked paths, so any change to the autonerves
FITS writer rewrote a committed binary and dirtied the tree for every contributor. #483
demonstrated it: the PyAutoNerves#155 header-comment fix ([""] -> "") silently modified
structures/arrays/files/array/output_test/array.fits the moment the autonerves floor moved —
identical cards, values, data and byte size, but a modified tracked file that had to be either
committed into an unrelated PR or left dirtying the tree.

This applies the durable fix uniformly rather than patching file-by-file again. The nine tests
that wrote into an output_test/ directory now take pytest's tmp_path and drop their
rmtree/makedirs preamble, and the 13 exposed artifacts are untracked. After a full run no
output_test/ directory is created anywhere in the source tree.

The scope narrowed after auditing the inventory

Of the 13 tracked files, only one was a live output — the array.fits that #483 flipped. The
other 12 were orphans: no test referenced their paths, and a repo-wide grep for their basenames
returned nothing. They were residue from tests deleted long ago — as were the two file-by-file
.gitignore lines, which named generated files for a test that no longer exists.

The issue's open question about test_uniform_1d.py:12 resolves the same way: that path was
written, not read. No file in the set was a real input, so nothing needed relocating instead of
untracking.

Two incidental fixes fall out

  • test_uniform_1d and test_uniform_2d both rmtree'd the same shared output directory — an
    ordering hazard between two test modules that tmp_path removes.
  • The three imaging tests taking the test_data_path fixture wrote their generated FITS into the
    source tree through it; they now use tmp_path and the fixture is gone.

API Changes

None — this PR touches test_autoarray/ and .gitignore only. No module under autoarray/ is
modified, so there is no public-API surface change and no downstream workspace migration.

Test Plan

  • Full suite from a clean checkout: 1177 passed, 55 skipped — identical to the pre-change
    baseline on main (1177/55).
  • Suite run twice in a row with git status --porcelain asserted unchanged after each. The
    second run is what would catch a test that had silently depended on a committed artifact: it
    would fail on run 1, not run 2.
  • find test_autoarray -path "*output_test*" returns nothing after a full run — the tests no
    longer write into the source tree at all.
  • No tracked file remains under any output_test/ path (git ls-files | grep output_test).

Sibling repos

Checked as the issue asked, and not widened into this PR. Neither PyAutoGalaxy nor PyAutoLens
uses the output_test/ name, and both track zero test-output artifacts — this defect is
autoarray-only. PyAutoLens does have a smaller, different problem (its tests write to
test_autolens/{imaging,interferometer}/data_temp/, which its .gitignore does not cover — only
the integration/ copies), filed separately rather than mixed in here.

Full API Changes (for automation & release notes)

Removed

  • test_autoarray/dataset/imaging/test_dataset.py::make_test_data_path — the test_data_path
    pytest fixture, which created files/array/output_test/ in the source tree. Its three consumers
    now take tmp_path. Test-suite-internal; not part of the autoarray package.

Added

  • Nothing.

Migration

  • None. No autoarray public symbol is added, removed or changed.

Closes #494

Generated by the PyAutoLabs agent workflow.


Generated by Claude Code

test_autoarray wrote test *output* into tracked paths, so any change to the
autonerves FITS writer rewrote a committed binary and dirtied the tree for every
contributor. #483 demonstrated it: the PyAutoNerves#155 header-comment fix
([""] -> "") silently modified structures/arrays/files/array/output_test/array.fits
the moment the autonerves floor moved -- identical cards, values, data and byte
size, but a modified tracked file that had to be committed into an unrelated PR.

Applies the durable fix uniformly rather than patching file-by-file again: the
nine tests that wrote into an output_test/ directory now take pytest's tmp_path
and drop their rmtree/makedirs preamble. After a full run no output_test/
directory is created anywhere in the source tree.

Untracks the 13 exposed artifacts. Only one of them was a live output -- the
array.fits that #483 flipped. The other twelve were orphans: no test referenced
their paths, and a repo-wide grep for their basenames returned nothing. They
were residue from tests deleted long ago, as were the two file-by-file
.gitignore lines, now replaced by a test_autoarray/**/output_test/ pattern that
serves as a backstop against a future writer regressing this.

Two incidental fixes fall out. test_uniform_1d and test_uniform_2d both rmtree'd
the same shared output directory, an ordering hazard tmp_path removes. And the
three imaging tests that took the test_data_path fixture wrote their generated
FITS into the source tree via that fixture; they now use tmp_path and the
fixture is gone.

Verified from a clean checkout: 1177 passed, 55 skipped, run twice in a row with
git status clean after each -- the second run is what would catch a test that
had silently depended on a committed artifact.

Closes #494

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QoAeGsJyiaLG4oqXb9n3dM
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Aug 27, 2026 — with Claude
@Jammy2211
Jammy2211 merged commit a5d718e into main Aug 27, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the feature/untrack-fits-test-artifacts branch August 27, 2026 18:27
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: untrack generated FITS output artifacts in test_autoarray

2 participants