diff options
| author | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2014-08-22 11:38:56 +0900 |
|---|---|---|
| committer | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2014-08-22 11:38:56 +0900 |
| commit | e8b870de0cbaf724986b65de9552262ac253a6d2 (patch) | |
| tree | d7a69ebf0ce5cb96cb6b1364a495a6c63f80887b /tests/test_ext_viewcode.py | |
| parent | de0b87be3e3504c744ad9f589ae83f324a66cd35 (diff) | |
| download | sphinx-git-e8b870de0cbaf724986b65de9552262ac253a6d2.tar.gz | |
:mod:`~sphinx.ext.viewcode` support imported function/class aliases. Closes #623
Diffstat (limited to 'tests/test_ext_viewcode.py')
| -rw-r--r-- | tests/test_ext_viewcode.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_ext_viewcode.py b/tests/test_ext_viewcode.py new file mode 100644 index 000000000..deab0cb20 --- /dev/null +++ b/tests/test_ext_viewcode.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*-
+"""
+ test_ext_viewcode
+ ~~~~~~~~~~~~~~~~~
+
+ Test sphinx.ext.viewcode extension.
+
+ :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+import re
+from StringIO import StringIO
+
+from util import test_roots, with_app
+
+
+warnfile = StringIO()
+root = test_roots / 'test-ext-viewcode'
+doctreedir = root / '_build' / 'doctree'
+
+
+def teardown_module():
+ (root / '_build').rmtree(True)
+
+
+@with_app(srcdir=root, warning=warnfile)
+def test_simple(app):
+ app.builder.build_all()
+
+ warnings = re.sub(r'\\+', '/', warnfile.getvalue())
+ assert re.findall(
+ r"index.rst:\d+: WARNING: Object named 'func1' not found in include " +
+ r"file .*/spam/__init__.py'",
+ warnings
+ )
+
+ result = (app.outdir / 'index.html').text(encoding='utf-8')
+ assert result.count('href="_modules/spam/mod1.html#func1"') == 2
+ assert result.count('href="_modules/spam/mod2.html#func2"') == 2
|
