diff options
Diffstat (limited to 'tests/roots/test-ext-autosummary')
5 files changed, 100 insertions, 0 deletions
diff --git a/tests/roots/test-ext-autosummary/autosummary_class_module.py b/tests/roots/test-ext-autosummary/autosummary_class_module.py new file mode 100644 index 0000000..f13de17 --- /dev/null +++ b/tests/roots/test-ext-autosummary/autosummary_class_module.py @@ -0,0 +1,2 @@ +class Class(): + pass diff --git a/tests/roots/test-ext-autosummary/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary/autosummary_dummy_module.py new file mode 100644 index 0000000..2d8829a --- /dev/null +++ b/tests/roots/test-ext-autosummary/autosummary_dummy_module.py @@ -0,0 +1,68 @@ +from os import path +from typing import Union + +from autosummary_class_module import Class + +__all__ = [ + "CONSTANT1", + "Exc", + "Foo", + "_Baz", + "bar", + "qux", + "path", +] + +#: module variable +CONSTANT1 = None +CONSTANT2 = None + + +class Foo: + #: class variable + CONSTANT3 = None + CONSTANT4 = None + + class Bar: + pass + + def __init__(self): + #: docstring + self.value = 1 + + 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 +#: a module-level attribute that has been excluded from __all__ +quuz = 2 + +considered_as_imported = Class() +non_imported_member = Class() +""" This attribute has a docstring, so it is recognized as a not-imported member """ diff --git a/tests/roots/test-ext-autosummary/autosummary_importfail.py b/tests/roots/test-ext-autosummary/autosummary_importfail.py new file mode 100644 index 0000000..9e3f9f1 --- /dev/null +++ b/tests/roots/test-ext-autosummary/autosummary_importfail.py @@ -0,0 +1,4 @@ +import sys + +# Fail module import in a catastrophic way +sys.exit(1) diff --git a/tests/roots/test-ext-autosummary/conf.py b/tests/roots/test-ext-autosummary/conf.py new file mode 100644 index 0000000..55c769c --- /dev/null +++ b/tests/roots/test-ext-autosummary/conf.py @@ -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' diff --git a/tests/roots/test-ext-autosummary/index.rst b/tests/roots/test-ext-autosummary/index.rst new file mode 100644 index 0000000..904c5fd --- /dev/null +++ b/tests/roots/test-ext-autosummary/index.rst @@ -0,0 +1,16 @@ + +: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.Foo.value + autosummary_dummy_module.bar + autosummary_dummy_module.qux + autosummary_importfail |