Skip to content

Commit

Permalink
intersphinx, fixup of d3c41f
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobandersen committed Apr 13, 2024
1 parent 1f7b497 commit e812dd9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions sphinx/ext/intersphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
logger = logging.getLogger(__name__)


def process_disabled_reftypes(env: BuildEnvironment) -> None:
def _process_disabled_reftypes(env: BuildEnvironment) -> None:
# Compile intersphinx_disabled_reftypes into datastructures
# easier to check during reference resolution.
# It is a separate function so the tests can use it.
Expand All @@ -87,7 +87,7 @@ def __init__(self, env: BuildEnvironment) -> None:
self.env = env

if not hasattr(env, 'intersphinx_cache'):
process_disabled_reftypes(env)
_process_disabled_reftypes(env)
# initial storage when fetching inventories before processing
self.env.intersphinx_cache = {} # type: ignore[attr-defined]

Expand Down
12 changes: 6 additions & 6 deletions tests/test_extensions/test_ext_intersphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
load_mappings,
missing_reference,
normalize_intersphinx_mapping,
process_disabled_reftypes,
_process_disabled_reftypes,
)
from sphinx.ext.intersphinx import setup as intersphinx_setup
from sphinx.util.console import strip_colors
Expand Down Expand Up @@ -46,7 +46,7 @@ def set_config(app, mapping):
app.config.intersphinx_mapping = mapping
app.config.intersphinx_cache_limit = 0
app.config.intersphinx_disabled_reftypes = []
process_disabled_reftypes(app.env)
_process_disabled_reftypes(app.env)


@mock.patch('sphinx.ext.intersphinx.InventoryFile')
Expand Down Expand Up @@ -398,22 +398,22 @@ def assert_(rn, expected):

# the base case, everything should resolve
assert app.config.intersphinx_disabled_reftypes == []
process_disabled_reftypes(app.env)
_process_disabled_reftypes(app.env)
case(term=True, doc=True, py=True)

# disabled a single ref type
app.config.intersphinx_disabled_reftypes = ['std:doc']
process_disabled_reftypes(app.env)
_process_disabled_reftypes(app.env)
case(term=True, doc=False, py=True)

# disabled a whole domain
app.config.intersphinx_disabled_reftypes = ['std:*']
process_disabled_reftypes(app.env)
_process_disabled_reftypes(app.env)
case(term=False, doc=False, py=True)

# disabled all domains
app.config.intersphinx_disabled_reftypes = ['*']
process_disabled_reftypes(app.env)
_process_disabled_reftypes(app.env)
case(term=False, doc=False, py=False)


Expand Down

0 comments on commit e812dd9

Please sign in to comment.