Repository navigation
Conversation
This branch has not been deployed
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.
Purpose
Hej,
while investigating the CI failures in #14677, I found that
test_html_rebuild_mocan fail after a slow build even when Sphinx's outdated-file check is correct.I reported the timing problem in #14678.
The test moves
bom.mofive seconds forward from its previous mtime.If the document was read more than five seconds after that mtime, the resulting catalog mtime is still older than the recorded document read time.
Sphinx then correctly considers
bomup to date, while the test expects it to be outdated.This fix instead uses the stored document read time as the boundary for the test.
It first puts
bom.moten seconds before that time and verifies that no document is outdated.It then puts the catalog five seconds after both its old mtime and the document read time, checks the nanosecond mtime recorded by the filesystem, and verifies that only
bombecomes outdated.This tests both sides of the invalidation boundary without depending on the build duration or the wall clock.
Sphinx's invalidation behavior is unchanged.
With the fix, the focused test passed with Docutils 0.21.2, locked Docutils 0.22.3, and Docutils development revision
335c924f838ac9180231cf2164f301cc6f6b4ca1.References
It uses
max(old_mtime, time.time()) + 5and checks the resulting mtime against the recorded document read time.This fixes the observed slow-build failure because the current time will normally be later than the document read time, but it still assumes that the current time plus five seconds is later than the stored document timestamp.
Its assertion detects that case, but the test setup would still fail.
This patch derives the timestamp directly from the stored document read time and explicitly checks both the up-to-date and outdated sides of the boundary.
AI Disclosure
OpenAI Codex assisted with reproducing the failure, reviewing the test change,
and running the checks described above. All AI-assisted work was reviewed and understood by me.