-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix #9240: Unknown node error for pending_xref_condition is raised #9246
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
Merged
tk0miya
merged 1 commit into
sphinx-doc:4.0.x
from
tk0miya:9240_unknown_node_pending_xref_condition
May 19, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
1 change: 1 addition & 0 deletions
1
tests/roots/test-transforms-post_transforms-missing-reference/conf.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nitpicky = True |
5 changes: 5 additions & 0 deletions
5
tests/roots/test-transforms-post_transforms-missing-reference/index.rst
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
transforms-post_transforms-missing-reference | ||
============================================ | ||
|
||
:class:`io.StringIO` | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
""" | ||
test_transforms_post_transforms | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Tests the post_transforms | ||
|
||
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. | ||
:license: BSD, see LICENSE for details. | ||
""" | ||
|
||
import pytest | ||
from docutils import nodes | ||
|
||
|
||
@pytest.mark.sphinx('html', testroot='transforms-post_transforms-missing-reference') | ||
def test_nitpicky_warning(app, status, warning): | ||
app.build() | ||
assert ('index.rst:4: WARNING: py:class reference target ' | ||
'not found: io.StringIO' in warning.getvalue()) | ||
|
||
content = (app.outdir / 'index.html').read_text() | ||
assert ('<p><code class="xref py py-class docutils literal notranslate"><span class="pre">' | ||
'io.StringIO</span></code></p>' in content) | ||
|
||
|
||
@pytest.mark.sphinx('html', testroot='transforms-post_transforms-missing-reference', | ||
freshenv=True) | ||
def test_missing_reference(app, status, warning): | ||
def missing_reference(app, env, node, contnode): | ||
assert app is app | ||
assert env is app.env | ||
assert node['reftarget'] == 'io.StringIO' | ||
assert contnode.astext() == 'io.StringIO' | ||
|
||
return nodes.inline('', 'missing-reference.StringIO') | ||
|
||
warning.truncate(0) | ||
app.connect('missing-reference', missing_reference) | ||
app.build() | ||
assert warning.getvalue() == '' | ||
|
||
content = (app.outdir / 'index.html').read_text() | ||
assert '<p><span>missing-reference.StringIO</span></p>' in content | ||
|
||
|
||
@pytest.mark.sphinx('html', testroot='domain-py-python_use_unqualified_type_names', | ||
freshenv=True) | ||
def test_missing_reference_conditional_pending_xref(app, status, warning): | ||
def missing_reference(app, env, node, contnode): | ||
return contnode | ||
|
||
warning.truncate(0) | ||
app.connect('missing-reference', missing_reference) | ||
app.build() | ||
assert warning.getvalue() == '' | ||
|
||
content = (app.outdir / 'index.html').read_text() | ||
assert '<span class="n"><span class="pre">Age</span></span>' in content |
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tk0miya I just noticed, that you put this in the
Incompatible changes
section instead ofBugs fixed
. Also, this should probably read "Unknown node error for pending_xref_condition is no longer raised if ...".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, it's my wrong...