@@ -73,7 +73,7 @@ def app(make_app_setup: MakeApp) -> Sphinx:
73
73
"testmod.Class" : "test.Class" ,
74
74
"testmod.SubCl" : "test.SubCl" ,
75
75
"testmod.Excep" : "test.Excep" ,
76
- "testmod.Excep2" : " test.Excep2" ,
76
+ "testmod.Excep2" : ( "py:exc" , " test.Excep2") ,
77
77
"testmod.Gen" : "test.Gen" ,
78
78
},
79
79
)
@@ -248,7 +248,11 @@ def fn_test(m: object) -> None: # pragma: no cover
248
248
]
249
249
250
250
251
- def test_resolve (app : Sphinx ) -> None :
251
+ @pytest .mark .parametrize (
252
+ ("qualname" , "docname" ),
253
+ [("testmod.Class" , "test.Class" ), ("testmod.Excep2" , "test.Excep2" )],
254
+ )
255
+ def test_resolve (app : Sphinx , qualname : str , docname : str ) -> None :
252
256
"""Test that qualname_overrides affects _last_resolve as expected."""
253
257
from docutils .nodes import TextElement , reference
254
258
from sphinx .addnodes import pending_xref
@@ -258,10 +262,10 @@ def test_resolve(app: Sphinx) -> None:
258
262
259
263
# Inventory contains documented name
260
264
InventoryAdapter (app .env ).main_inventory ["py:class" ] = {
261
- "test.Class" : ("TestProj" , "1" , "https://x.com" , "Class" ),
265
+ docname : ("TestProj" , "1" , "https://x.com" , docname . split ( "." )[ - 1 ] ),
262
266
}
263
267
# Node contains name from code
264
- node = pending_xref (refdomain = "py" , reftarget = "testmod.Class" , reftype = "class" )
268
+ node = pending_xref (refdomain = "py" , reftarget = qualname , reftype = "class" )
265
269
266
270
resolved = _last_resolve (app , app .env , node , TextElement ())
267
271
assert isinstance (resolved , reference )
0 commit comments