mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
* rename a few test modules to make the names more consistent * do not copy/use Sphinx from build/ (unnecessary without 2to3) * use a temporary dir for *all* test projects, the source tree will stay pristine that way (default is tests/build) * speed up tests by ~3x by splitting up test projects and avoiding rebuilds
33 lines
936 B
Python
33 lines
936 B
Python
# -*- 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 util import with_app
|
|
|
|
|
|
@with_app(testroot='ext-viewcode')
|
|
def test_simple(app, status, warning):
|
|
app.builder.build_all()
|
|
|
|
warnings = re.sub(r'\\+', '/', warning.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
|
|
assert result.count('href="_modules/spam/mod1.html#Class1"') == 2
|
|
assert result.count('href="_modules/spam/mod2.html#Class2"') == 2
|