Fix relative paths in intersphinx links

This commit is contained in:
Andrey Golovizin
2016-09-14 10:55:18 +09:00
committed by Takeshi KOMIYA
parent 3eb56b1c6f
commit 584bb96a06
2 changed files with 16 additions and 1 deletions
+15
View File
@@ -135,6 +135,8 @@ def test_missing_reference(tempdir, app, status, warning):
app.config.intersphinx_mapping = {
'https://docs.python.org/': inv_file,
'py3k': ('https://docs.python.org/py3k/', inv_file),
'py3krel': ('py3k', inv_file), # relative path
'py3krelparent': ('../../py3k', inv_file), # relative path, parent dir
}
app.config.intersphinx_cache_limit = 0
@@ -202,6 +204,19 @@ def test_missing_reference(tempdir, app, status, warning):
assert rn is None
assert contnode[0].astext() == 'py3k:unknown'
# check relative paths
rn = reference_check('py', 'mod', 'py3krel:module1', 'foo')
assert rn['refuri'] == 'py3k/foo.html#module-module1'
rn = reference_check('py', 'mod', 'py3krelparent:module1', 'foo')
assert rn['refuri'] == '../../py3k/foo.html#module-module1'
rn = reference_check('py', 'mod', 'py3krel:module1', 'foo', refdoc='sub/dir/test')
assert rn['refuri'] == '../../py3k/foo.html#module-module1'
rn = reference_check('py', 'mod', 'py3krelparent:module1', 'foo', refdoc='sub/dir/test')
assert rn['refuri'] == '../../../../py3k/foo.html#module-module1'
@with_app()
@with_tempdir