@@ -218,7 +218,7 @@ def setup(app, get_doc_object_=get_doc_object):
218
218
219
219
app .setup_extension ('sphinx.ext.autosummary' )
220
220
221
- app .connect ('builder -inited' , update_config )
221
+ app .connect ('config -inited' , update_config )
222
222
app .connect ('autodoc-process-docstring' , mangle_docstrings )
223
223
app .connect ('autodoc-process-signature' , mangle_signature )
224
224
app .connect ('doctree-read' , relabel_references )
@@ -244,17 +244,19 @@ def setup(app, get_doc_object_=get_doc_object):
244
244
return metadata
245
245
246
246
247
- def update_config (app ):
247
+ def update_config (app , config = None ):
248
248
"""Update the configuration with default values."""
249
+ if config is None : # only really needed for testing
250
+ config = app .config
249
251
# Do not simply overwrite the `app.config.numpydoc_xref_aliases`
250
252
# otherwise the next sphinx-build will compare the incoming values (without
251
253
# our additions) to the old values (with our additions) and trigger
252
254
# a full rebuild!
253
- numpydoc_xref_aliases_complete = deepcopy (app . config .numpydoc_xref_aliases )
255
+ numpydoc_xref_aliases_complete = deepcopy (config .numpydoc_xref_aliases )
254
256
for key , value in DEFAULT_LINKS .items ():
255
257
if key not in numpydoc_xref_aliases_complete :
256
258
numpydoc_xref_aliases_complete [key ] = value
257
- app . config .numpydoc_xref_aliases_complete = numpydoc_xref_aliases_complete
259
+ config .numpydoc_xref_aliases_complete = numpydoc_xref_aliases_complete
258
260
259
261
260
262
# ------------------------------------------------------------------------------
0 commit comments