Skip to content

Fix timing dependency in test_html_rebuild_mo - #14679

Open
Darlokt wants to merge 10 commits into
sphinx-doc:masterfrom
Darlokt:fix-mo-test-timestamp-instability
Open

Darlokt wants to merge 10 commits into
sphinx-doc:masterfrom
Darlokt:fix-mo-test-timestamp-instability

Conversation

@Darlokt

@Darlokt Darlokt commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Purpose

Hej,
while investigating the CI failures in #14677, I found that test_html_rebuild_mo can 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.mo five 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 bom up 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.mo ten 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 bom becomes 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

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_html_rebuild_mo can fail after a slow build

2 participants