Tests write fixed filenames into the shared tempdir, so two suites on - #290
Merged
1-Bart-1 merged 1 commit intoSep 11, 2026
Merged
Conversation
Five test files wrote fixed names straight into tempdir(), which is /tmp when TMPDIR is unset and so shared by every suite on the machine. A second run's cleanup landing between one run's save and its isfile assertion fails that assertion. Each affected testset now opens a per-run mktempdir(). mktempdir() removes itself at process exit, so the hand cleanup that existed only to keep the shared directory tidy goes with it: test_plotting.jl's safe_rm helper and its call sites, the try/finally whose finally block had accumulated five of the save_plot tests, and the cleanup_test_files helpers in the yaml_geometry tests. test_plotting.jl's `!isdir(nested_dir) && @test !isdir(nested_dir)` becomes an unconditional assertion. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014b7xG7wnJFW2vx2Ji5nwGW
Contributor
Author
|
Local full suite: PASS (8 min, Julia 1.12.7, one cell of the matrix) |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
1-Bart-1
approved these changes
Sep 11, 2026
1-Bart-1
deleted the
agent/286-tests-write-fixed-filenames-into-the-sha
branch
September 11, 2026 20:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Four test files wrote fixed filenames straight into
tempdir()—/tmpwhenTMPDIRis unset, and so shared by every suite running on the box — where a second run's cleanup can land between one run's save and itsisfileassertion. Each affected testset now opens its ownmktempdir(), and the hand cleanup that existed only to keep that shared directory tidy goes with it.What was wrong
tempdir()is one directory for the whole machine. The agent box runs several VortexStepMethod worktrees' suites at once, and they were all writing the same names into it:Rectangular_wing_geometry_*_view.png,Rectangular_Wing_Polars.png,test_polar.csv,test_wing.yaml,polars/,subtest/,test.obj,test.dat. Whoever ran second overwrote or deleted the first run's fixture, and the first run's next assertion failed.The evidence for it being sharing rather than code is in #285's
agent ci-local(Plotting (Makie) | 4 passed 1 failed 5 total, the failure being theangled_view.pngisfile) plus the same commit passing 58/58 on the next run. GitHub CI never sees it: one suite per runner.I reproduced the mechanism directly rather than by racing whole suites. Two threads, one writing
test_load_polar_data.jl's "Valid CSV File" fixture and reading it straight back, one writing that file's "Empty CSV File" case, 400 rounds:What changed
test/obj_adapter/,test/surfplan/andtest/airfoil_aero/already do this, so the fix is to follow them: onemktempdir()per testset, every path built from it. Nothing about what the tests assert changes.mktempdir()deletes itself at process exit, so everyrmthat existed only to keep/tmptidy came out with it, and that is most of the diff:test_plotting.jl'ssafe_rmhelper — a two-attempt retry-and-swallow delete — and its 25 call sites. With no caller left the helper went too.try/finallyaround thesave_plottests. Itsfinallyblock had accumulated five of the eight tests, which therefore ran as cleanup: if test 3 threw, tests 4–8 ran anyway and the testset reported whatever they found. They are now plain sequential tests.!isdir(nested_dir) && @test !isdir(nested_dir), written that way because the directory might hold a previous run's leftovers, is now the unconditional@test !isdir(nested_dir)it was meant to be.cleanup_test_files()in bothyaml_geometrytests, and the trailingrm(test_obj_path)/rm(test_dat_path)intest_kite_geometry.jl.Two things I found on the way and folded in, both in files already open in this diff.
test_kite_geometry.jlbuilt its polar paths asjoinpath(tempdir(), test_dat_path[1:end-4] * "_cl_polar.csv")—test_dat_pathis absolute, sojoinpathdiscarded the prefix and the call did nothing; the path is now written directly. Andtest_kite_geometry.jlre-declaredtest_dat_pathinside a nested testset with the value it already had.Three of the four
cpcalls intest_wing_constructor.jldiffered only in which airfoil and which name, so they are one loop over the two airfoils.Where I would push back
/tmpon this box still holdstest_cl_polar.csv,test_cd_polar.csv,test_cm_polar.csvandtest_info.bin— files the old code never deleted at all, only overwrote. Their timestamps moved while I was working on this (00:22 → 00:33), and/tmp/test_polar.csvwas deleted under me by somebody'scleanup_test_files(), so the collision is not hypothetical on this box. Those leftovers belong to the other worktrees' copies of these tests and will clear as this lands.Left alone deliberately:
test/test_data_utils.jl:164also writes intotempdir(), but with arandstring(8)in the name, so two runs cannot collide there.No changelog entry — nothing user-visible changes.
Verification
shared tempdir() : 395 / 400 reads lostagainstper-run mktempdir : 0 / 400, two threads on the fixed path this suite usestest/yaml_geometry/+test/ram_geometry/viaruntests.jl(juliaserver): 199 pass, 1 broken (the pre-existing@test_skip), 0 fail, 31.4 s/tmpgained none of the fixed names — thetest_c*_polar.csvsitting there belong to another worktree's copy of the unfixed testagent ci-local: PASS in 7m — that is wheretest/plotting/test_plotting.jlran, and where NONLIN misses the tolerances at 26.6° where LOOP converges #285 saw the failure. GitHub CI triggers onpull_request, so it starts when this PR opensCairoMakie, atest/-only dependency, and this worktree has notest/Manifest-v1.12.toml(norexamples/), which §2 forbids me creating by handjetls checknot run —jetlsis not on this boxbin/reuse_lint· up to date withorigin/main(3f75701)save_plottests now share one directory with the earlierplot_geometry/plot_polarssaves instead of a dedicated one. The names do not overlap, and thexor(isfile(pdf), isfile(png))check still starts from a directory holding neithertest_backend_aware.pdfnor.png, but that assertion is the one to look at first if the plotting testset misbehaves.Scope
+79 / −170 across 4 files, tests only. The net −91 is the deleted cleanup:
safe_rmand its call sites, twocleanup_test_fileshelpers, and thetry/finallythat held five tests. No stack.Closes #286 · task
VortexStepMethod.jl-286