forked from celery/celery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Sphinx autodoc picks up tasks automatically only if `undoc-membe…
…rs` is set (celery#4584) * Add unit test for celery.contrib.sphinx Note that this unit test reveals a bug: tasks are documented automatically (e.g. without explicitly adding a `.. autotask::` line) only if the `undoc-members` option is set. Try removing '`undoc-members'` from `autodoc_default_flags` in conf.py, and the test will fail! * WIP: Remove undoc-members in test_sphinx
- Loading branch information
Showing
5 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
|
||
import os | ||
import sys | ||
|
||
extensions = ['celery.contrib.sphinx', 'sphinx.ext.autodoc'] | ||
autodoc_default_flags = ['members'] | ||
autosummary_generate = True | ||
|
||
sys.path.insert(0, os.path.abspath('.')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.. automodule:: foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
|
||
from celery import Celery | ||
|
||
app = Celery() | ||
|
||
|
||
@app.task | ||
def bar(): | ||
"""This task has a docstring!""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
|
||
import pkg_resources | ||
import pytest | ||
|
||
try: | ||
sphinx_build = pkg_resources.load_entry_point( | ||
'sphinx', 'console_scripts', 'sphinx-build') | ||
except pkg_resources.DistributionNotFound: | ||
sphinx_build = None | ||
|
||
|
||
@pytest.mark.skipif(sphinx_build is None, reason='Sphinx is not installed') | ||
def test_sphinx(tmpdir): | ||
srcdir = pkg_resources.resource_filename(__name__, 'proj') | ||
sphinx_build([srcdir, str(tmpdir)]) | ||
with open(tmpdir / 'contents.html', 'r') as f: | ||
contents = f.read() | ||
assert 'This task has a docstring!' in contents |