-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Tests: regression with Docutils HEAD (0.22-rc) #13539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This regression is a showstopper for the planned release of Docutils 0.23 :( From the PR, it seems the reason is Docutils commit r10093 "Change section handling to not rely on exceptions and reparsing." It seems the PR only changes an auxilliary function in the test code. Could you try, whether just adding @@ -39,14 +40,14 @@ def make_directive_and_state(
inliner.init_customizations(state.document.settings)
state.inliner = inliner
state.parent = None
state.memo = SimpleNamespace(
document=state.document,
language=english,
inliner=state.inliner,
reporter=state.document.reporter,
section_level=0,
title_styles=[],
+ section_parents=[],
directive = SphinxDirective(
name='test_directive',
arguments=[], If not, it may help to adapt the test code for different values of |
That's correct - the PR only modifies the test code so far. I may extend it with other fixes as we discover them, but I'm not familiar with the As far as I am aware: no, the sole place where we assign to the |
Yep, that sounds worth a try. I should be able to attempt that within the next few hours. |
That does indeed work, and seems to be a lighter touch / simpler fix. I'll push a commit with that here in a few moments. |
From the issue, I am suspicious of "I was having problems with a custom directive's nested parse of its content when section headers were used". Directives generally should not contain section headers, and we have extensive work-arounds in Sphinx for this (see A |
I understand your suspicion. However, the patch published in "the issue" is rather a by-product of working on the custom directive. The orignal "section-in-directive parsing" problem was directly reported to the docutils-devel mailing list. It is not solved by the patch. The reasons for accepting the patch are:
I am very reluctant to revert/postpone this change (and re-open Bug#346) until it turns out to be an insurmountable obstacle to the compatibility of Doctils 0.23 and Sphinx. |
Thanks Günter (and also sorry I haven't had much time recently for Docutils work). Hopefully we can get to the bottom of the failures within Sphinx. A |
AFAIK, the reason is that the "mock" memo in the test suite needs to set up the The first attempt of a fix failed, maybe, because it copied the initialization from the Docutils source but did not fully adapt it to the different context: The line Regarding the failure of the re-occuring failure "8 minutes ago", I can only see |
You may need to refresh the page? I see the below, and then scrolling back shows the previous lines. This is on Firefox. If that doesn't work at all, you can open the raw logs (gear symbol in the top-right -> 'View raw logs'), it should be a link like https://github.com/sphinx-doc/sphinx/commit/fa12cc6bac609c12afec755ec01d78ae2cce6f96/checks/42086233845/logs |
See #13548 to introduce A |
A note from a post I sent to the $ sphinx-build -b html tests/roots/test-directive-only/ _build
... [ snip ] ...
CRITICAL: Title level inconsistent:
1.5.2. Subsection
~~~~~~~~~~~~~~~~~ [docutils]
... [ snip ] ... NB: this didn't occur with |
The problem seems to be with the from __future__ import annotations
import shutil
from pathlib import Path
from sphinx.cmd.make_mode import run_make_mode
Path('index.rst').write_text("""\
reproducer
==========
1. Section
----------
Lorem ipsum.
1.1. Subsection
~~~~~~~~~~~~~~~
Lorem ipsum.
.. only:: not nonexisting_tag
2. Section
----------
Lorem ipsum.
3. Section
----------
Lorem ipsum.
.. only:: not nonexisting_tag
4. Section
----------
Lorem ipsum.
5. Section
----------
Lorem ipsum.
.. only:: not nonexisting_tag
6. Section
----------
Lorem ipsum.
7. Section
----------
Lorem ipsum.
7.1. Subsection
~~~~~~~~~~~~~~~
Lorem ipsum.
.. only:: not nonexisting_tag
7.1.1. Subsubsection
####################
Lorem ipsum.
8. Section
------------
Fails!
""", encoding='utf-8')
Path('conf.py').write_bytes(b'')
shutil.rmtree('_build', ignore_errors=True)
run_make_mode(['text', '.', '_build', '--show-traceback', '--fail-on-warning']) |
Resolved by #13548 + #13549. Thanks @AA-Turner @gmilde! |
With #13549 and #13551, tests are now passing. Thanks to @gmilde and @jayaddison for the investigations and help. This is a hard breaking change from Docutils, though, as This will break breathe, sphinx-needs (cc @chrisjsewell), sphinx.includechangelog, the linux kernel documentation, etc. We (in Docutils) should find a way to keep the new feature but revert the hard breakage, or work to communicate this much better, and ideally propose fixes for the breakage introduced by the changes in Docutils. A |
Re-opening to discuss the ecosystem impact of this breaking change |
Please test, if Docutils commit r10129 fixes/alleviates the compatibility problems. |
Determine the "section_parents" list by inspecting the current node's parents when required instead of keeping it in the `states.RSTStateMachine.memo`. The introduction of a stack of "section_parents" in `states.RSTStateMachine.memo` proved to be a "hard breaking change" for Sphinx and several Sphinx extensions. sphinx-doc/sphinx#13539 (comment) git-svn-id: svn://svn.code.sf.net/p/docutils/code/trunk@10129 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Determine the "section_parents" list by inspecting the current node's parents when required instead of keeping it in the `states.RSTStateMachine.memo`. The introduction of a stack of "section_parents" in `states.RSTStateMachine.memo` proved to be a "hard breaking change" for Sphinx and several Sphinx extensions. sphinx-doc/sphinx#13539 (comment) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10129 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Determine the "section_parents" list by inspecting the current node's parents when required instead of keeping it in the `states.RSTStateMachine.memo`. The introduction of a stack of "section_parents" in `states.RSTStateMachine.memo` proved to be a "hard breaking change" for Sphinx and several Sphinx extensions. sphinx-doc/sphinx#13539 (comment) git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@10129 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
@AA-Turner |
In my local environment, the reproducer no longer fails with sphinx-build 8.2.3 and Docutils HEAD. |
See #13560 to remove A |
@AA-Turner Could you re-run the tests with current Docutils HEAD, please? Commit r10131 (with sphinx-build 8.2.3) solves the problem in a local test project. |
According to the checks for #13560, tests ran OK 20h ago Let's see whether the projects mentioned in #13539 (comment) are fine, too. |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
The Sphinx unit tests when running with the latest HEAD commit of
docutils
are failing.An illustrative case from 2025-05-08 can be found in the failed build at: https://github.com/sphinx-doc/sphinx/actions/runs/14915538556/job/41900098124
There appear to be at a few categories of error:
Child-node count mismatches (ref):
An index range error (ref):
...and a missing-attribute error (ref):
How to Reproduce
Environment Information
Sphinx extensions
Additional context
No response
Edit: fixup: include attribute-error and context instead of a hyperlink to it.
The text was updated successfully, but these errors were encountered: