summaryrefslogtreecommitdiff
path: root/tests/test_autodoc.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-03-22 18:58:26 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-03-22 23:13:49 +0900
commit5c396b6325349fe577f21bc7e1db8f96aaa4f5be (patch)
tree32b950d091908722560016027ec6bc8cb981dd66 /tests/test_autodoc.py
parent5138255665f1c724bd0ac239add6cabd68f7a9d4 (diff)
downloadsphinx-git-5c396b6325349fe577f21bc7e1db8f96aaa4f5be.tar.gz
Fix #7331: autodoc: a cython-function is not recognized as a function
Diffstat (limited to 'tests/test_autodoc.py')
-rw-r--r--tests/test_autodoc.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py
index 012292999..26a157002 100644
--- a/tests/test_autodoc.py
+++ b/tests/test_autodoc.py
@@ -22,6 +22,13 @@ from sphinx.testing.util import SphinxTestApp, Struct # NOQA
from sphinx.util import logging
from sphinx.util.docutils import LoggingReporter
+try:
+ # Enable pyximport to test cython module
+ import pyximport
+ pyximport.install()
+except ImportError:
+ pyximport = None
+
app = None
@@ -1609,3 +1616,22 @@ def test_singledispatchmethod():
' A method for general use.',
'',
]
+
+
+@pytest.mark.usefixtures('setup_test')
+@pytest.mark.skipif(pyximport is None, reason='cython is not installed')
+def test_cython():
+ options = {"members": None,
+ "undoc-members": None}
+ actual = do_autodoc(app, 'module', 'target.cython', options)
+ assert list(actual) == [
+ '',
+ '.. py:module:: target.cython',
+ '',
+ '',
+ '.. py:function:: foo(*args, **kwargs)',
+ ' :module: target.cython',
+ '',
+ ' Docstring.',
+ '',
+ ]