Skip to content

test(eval): stage the eval fixtures once per file, not six times - #4759

Merged
kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:kalin/stage-env-test-timeout
Oct 5, 2026
Merged

kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:kalin/stage-env-test-timeout

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

The required Windows unit job times out on test_restaging_replaces_built_repositories, which turns it red on PRs that have nothing to do with it (#4460's run is the first; any PR updated onto main since #4472 can hit it). Staging the eval fixtures takes about 28 seconds on the Windows runner now that it builds the tier repositories, and that test staged twice, landing on the 60-second per-test limit; its neighbour passed at 55 seconds.

The file staged the whole environment six times. It now stages once for the read-only checks and once more for a single re-staging test that covers both read-only files and built repositories, so no test comes near the limit and the file is about two minutes faster on Windows.

Test plan

  • pytest tests/unit/eval/test_stage_eval_env.py passes (7 tests; the POSIX-only fake-gh test still runs)
  • Unit Tests (Windows, py3.12) passes on this PR without a timeout in this file

The Windows unit job timed out on test_restaging_replaces_built_repositories: one staging takes about 28 s there now that it builds the tier repositories, and that test staged twice, landing on the 60 s per-test limit. The read-only checks share one staging and a single re-staging test covers both read-only files and built repositories.
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve

This stops the Windows unit job from timing out in the eval-staging tests. The file used to build the eval fixtures six times; now it builds them once and shares the result, and one test builds them a second time to check that re-staging replaces the old copy. The tests check the same things as before, and the re-staging check is now a little stronger. It is safe to merge as-is.

One minor point: running the re-staging test on its own on Windows would still be close to the 60-second limit. See the details below.

Real-world evidence

N/A: this PR only changes tests. No evidence bundle was produced, so the verdict rests on static review. The open Test plan item (Windows unit job green with no timeout in this file) is the real proof, so check it before merging.

🔍 Technical details

Issues found

🟢 Run on its own, the re-staging test still pays for two stagings (tests/unit/eval/test_stage_eval_env.py:119). pytest-timeout counts fixture setup against the test that triggers it (timeout_func_only defaults to false). In normal file order, test_stages_fixtures_… pays for the module-scoped staged setup, so the re-staging test only pays for its own stage() call. But pytest -k restaging on Windows, or any reordering or xdist split that runs it first, puts it back at about 56 s. CI does neither today, so this doesn't block merge. If you want to remove the risk, give it a @pytest.mark.timeout(120) or say in the comment that it relies on running after the read-only tests.

Notes

  • The re-staging test changes the shared fixture, but stage() rebuilds the whole tree. The read-only tests therefore pass whether they run before or after it, and the stale.txt assertion still holds.
  • The new .git marker assertion proves the built repository was actually replaced. The old check only confirmed .git existed, which a merge-instead-of-replace bug would also have passed.

Strengths

  • The fix targets the cause (repeated 28-second stagings) and doesn't just raise the timeout.
  • The two re-staging tests were merged without losing coverage, and the POSIX-only fake-gh test still runs.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 5, 2026
Merged via the queue into amd:main with commit c168dff Oct 5, 2026
@kovtcharov-amd
kovtcharov-amd deleted the kalin/stage-env-test-timeout branch October 5, 2026 21:29
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.

2 participants