mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix attempt with new test root
This commit is contained in:
parent
d4010540e5
commit
4e0ff5cac2
@ -74,6 +74,7 @@ class DummyApplication:
|
||||
self.warningiserror = False
|
||||
|
||||
self.config.add('autosummary_context', {}, True, None)
|
||||
self.config.add('autosummary_filename_map', {}, True, None)
|
||||
self.config.init_values()
|
||||
|
||||
def emit_firstresult(self, *args: Any) -> None:
|
||||
|
@ -0,0 +1,41 @@
|
||||
from os import path # NOQA
|
||||
from typing import Union
|
||||
|
||||
|
||||
class Foo:
|
||||
class Bar:
|
||||
pass
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def bar(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def baz(self):
|
||||
pass
|
||||
|
||||
|
||||
class _Baz:
|
||||
pass
|
||||
|
||||
|
||||
def bar(x: Union[int, str], y: int = 1) -> None:
|
||||
pass
|
||||
|
||||
|
||||
def _quux():
|
||||
pass
|
||||
|
||||
|
||||
class Exc(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class _Exc(Exception):
|
||||
pass
|
||||
|
||||
|
||||
#: a module-level attribute
|
||||
qux = 2
|
@ -0,0 +1,4 @@
|
||||
import sys
|
||||
|
||||
# Fail module import in a catastrophic way
|
||||
sys.exit(1)
|
10
tests/roots/test-ext-autosummary-filename-map/conf.py
Normal file
10
tests/roots/test-ext-autosummary-filename-map/conf.py
Normal file
@ -0,0 +1,10 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
extensions = ['sphinx.ext.autosummary']
|
||||
autosummary_generate = True
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
15
tests/roots/test-ext-autosummary-filename-map/index.rst
Normal file
15
tests/roots/test-ext-autosummary-filename-map/index.rst
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
:autolink:`autosummary_dummy_module.Foo`
|
||||
|
||||
:autolink:`autosummary_importfail`
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:caption: An autosummary
|
||||
|
||||
autosummary_dummy_module
|
||||
autosummary_dummy_module.Foo
|
||||
autosummary_dummy_module.Foo.Bar
|
||||
autosummary_dummy_module.bar
|
||||
autosummary_dummy_module.qux
|
||||
autosummary_importfail
|
@ -386,20 +386,18 @@ def test_autosummary_recursive(app, status, warning):
|
||||
assert 'package.package.module' in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx('dummy', testroot='ext-autosummary-recursive',
|
||||
@pytest.mark.sphinx('dummy', testroot='ext-autosummary-filename-map',
|
||||
confoverrides={'autosummary_filename_map':
|
||||
{"package": "package_mangled",
|
||||
"package.package": "package_package_mangled"}})
|
||||
{"autosummary_dummy_module": "module_mangled",
|
||||
"autosummary_dummy_module.bar": "bar"}})
|
||||
def test_autosummary_filename_map(app, status, warning):
|
||||
app.build()
|
||||
|
||||
assert (app.srcdir / 'generated' / 'package_mangled.rst').exists()
|
||||
assert not (app.srcdir / 'generated' / 'package.rst').exists()
|
||||
assert (app.srcdir / 'generated' / 'package.module.rst').exists()
|
||||
assert (app.srcdir / 'generated' / 'package.module_importfail.rst').exists() is False
|
||||
assert (app.srcdir / 'generated' / 'package_package_mangled.rst').exists()
|
||||
assert not (app.srcdir / 'generated' / 'package.package.rst').exists()
|
||||
assert (app.srcdir / 'generated' / 'package.package.module.rst').exists()
|
||||
assert (app.srcdir / 'generated' / 'module_mangled.rst').exists()
|
||||
assert not (app.srcdir / 'generated' / 'autosummary_dummy_module.rst').exists()
|
||||
assert (app.srcdir / 'generated' / 'bar.rst').exists()
|
||||
assert not (app.srcdir / 'generated' / 'autosummary_dummy_module.bar.rst').exists()
|
||||
assert (app.srcdir / 'generated' / 'autosummary_dummy_module.Foo.rst').exists()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex', **default_kw)
|
||||
|
Loading…
Reference in New Issue
Block a user