diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/root/autodoc.txt | 2 | ||||
| -rw-r--r-- | tests/root/autodoc_missing_imports.py | 9 | ||||
| -rw-r--r-- | tests/root/conf.py | 9 | ||||
| -rw-r--r-- | tests/root/includes.txt | 1 | ||||
| -rw-r--r-- | tests/root/objects.txt | 9 | ||||
| -rw-r--r-- | tests/test_autodoc.py | 11 | ||||
| -rw-r--r-- | tests/test_build_html.py | 5 | ||||
| -rw-r--r-- | tests/test_config.py | 8 | ||||
| -rw-r--r-- | tests/test_intersphinx.py | 4 | ||||
| -rw-r--r-- | tests/test_intl.py | 6 | ||||
| -rw-r--r-- | tests/test_quickstart.py | 1 | ||||
| -rw-r--r-- | tests/test_versioning.py | 1 | ||||
| -rw-r--r-- | tests/test_websupport.py | 7 | ||||
| -rw-r--r-- | tests/util.py | 7 |
14 files changed, 36 insertions, 44 deletions
diff --git a/tests/root/autodoc.txt b/tests/root/autodoc.txt index d4b3404c..aa0dffba 100644 --- a/tests/root/autodoc.txt +++ b/tests/root/autodoc.txt @@ -45,3 +45,5 @@ Just testing a few autodoc possibilities... :members: ca1, ia1 Specific members (2 total) + +.. automodule:: autodoc_missing_imports diff --git a/tests/root/autodoc_missing_imports.py b/tests/root/autodoc_missing_imports.py new file mode 100644 index 00000000..7a717345 --- /dev/null +++ b/tests/root/autodoc_missing_imports.py @@ -0,0 +1,9 @@ + +import missing_module +from missing_module import missing_name +import missing_package1.missing_module1 +from missing_package2 import missing_module2 +from missing_package3.missing_module3 import missing_name + +class TestAutodoc(object): + """TestAutodoc docstring.""" diff --git a/tests/root/conf.py b/tests/root/conf.py index 8025ba33..cf88c2bb 100644 --- a/tests/root/conf.py +++ b/tests/root/conf.py @@ -8,7 +8,7 @@ sys.path.append(os.path.abspath('..')) extensions = ['sphinx.ext.autodoc', 'sphinx.ext.jsmath', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.autosummary', 'sphinx.ext.doctest', 'sphinx.ext.extlinks', - 'sphinx.ext.viewcode', 'sphinx.ext.oldcmarkup', 'ext'] + 'sphinx.ext.viewcode', 'ext'] jsmath_path = 'dummy.js' @@ -71,6 +71,13 @@ autosummary_generate = ['autosummary'] extlinks = {'issue': ('http://bugs.python.org/issue%s', 'issue '), 'pyurl': ('http://python.org/%s', None)} +autodoc_mock_imports = [ + 'missing_module', + 'missing_package1.missing_module1', + 'missing_package2.missing_module2', + 'missing_package3.missing_module3', +] + # modify tags from conf.py tags.add('confpytag') diff --git a/tests/root/includes.txt b/tests/root/includes.txt index 904f0677..08917811 100644 --- a/tests/root/includes.txt +++ b/tests/root/includes.txt @@ -40,6 +40,7 @@ Literalinclude options .. cssclass:: inc-lines .. literalinclude:: literal.inc :lines: 6-7,9 + :lineno-start: 6 .. cssclass:: inc-startend .. literalinclude:: literal.inc diff --git a/tests/root/objects.txt b/tests/root/objects.txt index 57e82212..73661d22 100644 --- a/tests/root/objects.txt +++ b/tests/root/objects.txt @@ -101,6 +101,7 @@ Referring to :func:`nothing <>`. :type hour: DuplicateType :param hour: Duplicate param. Should not lead to crashes. :type hour: DuplicateType + :param .Cls extcls: A class from another module. C items @@ -117,14 +118,6 @@ C items .. c:var:: sphinx_global -Old C items (from oldcmarkup ext) ---------------------------------- - -.. cfunction:: Sphinx_Func() - -Refer to :cfunc:`Sphinx_Func`. - - Javascript items ================ diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index 3735a7b6..82eb0f71 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -751,12 +751,8 @@ def _funky_classmethod(name, b, c, d, docstring=None): some arguments.""" def template(cls, a, b, c, d=4, e=5, f=6): return a, b, c, d, e, f - if sys.version_info >= (2, 5): - from functools import partial - function = partial(template, b=b, c=c, d=d) - else: - def function(cls, a, e=5, f=6): - return template(a, b, c, d, e, f) + from functools import partial + function = partial(template, b=b, c=c, d=d) function.__name__ = name function.__doc__ = docstring return classmethod(function) @@ -788,10 +784,9 @@ class Class(Base): #: should be documented -- süß attr = 'bar' + @property def prop(self): """Property.""" - # stay 2.4 compatible (docstring!) - prop = property(prop, doc="Property.") docattr = 'baz' """should likewise be documented -- süß""" diff --git a/tests/test_build_html.py b/tests/test_build_html.py index ef8e3888..603ad546 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -44,9 +44,6 @@ reading included file u'.*?wrongenc.inc' seems to be wrong, try giving an \ %(root)s/includes.txt:4: WARNING: download file not readable: .*?nonexisting.png %(root)s/markup.txt:\\d+: WARNING: Malformed :option: u'Python c option', does \ not contain option marker - or -- or / -%(root)s/objects.txt:\\d*: WARNING: using old C markup; please migrate to \ -new-style markup \(e.g. c:function instead of cfunction\), see \ -http://sphinx-doc.org/domains.html """ HTML_WARNINGS = ENV_WARNINGS + """\ @@ -191,8 +188,6 @@ HTML_XPATH = { (".//a[@href='#c.SPHINX_USE_PYTHON']", ''), (".//a[@href='#c.SphinxType']", ''), (".//a[@href='#c.sphinx_global']", ''), - # reference from old C markup extension - (".//a[@href='#c.Sphinx_Func']", ''), # test global TOC created by toctree() (".//ul[@class='current']/li[@class='toctree-l1 current']/a[@href='']", 'Testing object descriptions'), diff --git a/tests/test_config.py b/tests/test_config.py index 4d3d51b0..ea6f3ba4 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -19,7 +19,8 @@ from sphinx.util.pycompat import b @with_app(confoverrides={'master_doc': 'master', 'nonexisting_value': 'True', - 'latex_elements.docclass': 'scrartcl'}) + 'latex_elements.docclass': 'scrartcl', + 'modindex_common_prefix': 'path1,path2'}) def test_core_config(app): cfg = app.config @@ -31,6 +32,7 @@ def test_core_config(app): # overrides assert cfg.master_doc == 'master' assert cfg.latex_elements['docclass'] == 'scrartcl' + assert cfg.modindex_common_prefix == ['path1', 'path2'] # simple default values assert 'locale_dirs' not in cfg.__dict__ @@ -92,7 +94,7 @@ def test_errors_warnings(dir): write_file(dir / 'conf.py', u'# -*- coding: utf-8\n\n' u'project = u"Jägermeister"\n', 'utf-8') cfg = Config(dir, 'conf.py', {}, None) - cfg.init_values() + cfg.init_values(lambda warning: 1/0) assert cfg.project == u'Jägermeister' # test the warning for bytestrings with non-ascii content @@ -122,5 +124,5 @@ def test_config_eol(tmpdir): for eol in ('\n', '\r\n'): configfile.write_bytes(b('project = "spam"' + eol)) cfg = Config(tmpdir, 'conf.py', {}, None) - cfg.init_values() + cfg.init_values(lambda warning: 1/0) assert cfg.project == u'spam' diff --git a/tests/test_intersphinx.py b/tests/test_intersphinx.py index a8679e7e..8ce02cc1 100644 --- a/tests/test_intersphinx.py +++ b/tests/test_intersphinx.py @@ -81,7 +81,7 @@ def test_read_inventory_v2(): '/util/glossary.html#term-a-term' -@with_app(confoverrides={'extensions': 'sphinx.ext.intersphinx'}) +@with_app() @with_tempdir def test_missing_reference(tempdir, app): inv_file = tempdir / 'inventory' @@ -157,7 +157,7 @@ def test_missing_reference(tempdir, app): assert contnode[0].astext() == 'py3k:unknown' -@with_app(confoverrides={'extensions': 'sphinx.ext.intersphinx'}) +@with_app() @with_tempdir def test_load_mappings_warnings(tempdir, app): """ diff --git a/tests/test_intl.py b/tests/test_intl.py index c9822089..0119d677 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -16,8 +16,6 @@ from StringIO import StringIO from subprocess import Popen, PIPE from xml.etree import ElementTree -from sphinx.util.pycompat import relpath - from util import test_roots, path, with_app, SkipTest @@ -49,7 +47,7 @@ def setup_module(): for f in [f for f in files if f.endswith('.po')]: po = dirpath / f mo = root / 'xx' / 'LC_MESSAGES' / ( - relpath(po[:-3], root) + '.mo') + os.path.relpath(po[:-3], root) + '.mo') if not mo.parent.exists(): mo.parent.makedirs() try: @@ -75,7 +73,7 @@ def teardown_module(): def elem_gettexts(elem): def itertext(self): # this function copied from Python-2.7 'ElementTree.itertext'. - # for compatibility to Python-2.5, 2.6, 3.1 + # for compatibility to Python-2.6 tag = self.tag if not isinstance(tag, basestring) and tag is not None: return diff --git a/tests/test_quickstart.py b/tests/test_quickstart.py index 9daa7401..7323f48e 100644 --- a/tests/test_quickstart.py +++ b/tests/test_quickstart.py @@ -170,6 +170,7 @@ def test_quickstart_all_answers(tempdir): 'Author name': u'Wolfgang Schäuble & G\'Beckstein'.encode('utf-8'), 'Project version': '2.0', 'Project release': '2.0.1', + 'Project language': 'de', 'Source file suffix': '.txt', 'Name of your master document': 'contents', 'autodoc': 'y', diff --git a/tests/test_versioning.py b/tests/test_versioning.py index 6469a33c..5cff92ff 100644 --- a/tests/test_versioning.py +++ b/tests/test_versioning.py @@ -15,7 +15,6 @@ from docutils.parsers.rst.directives.html import MetaBody from sphinx import addnodes from sphinx.versioning import add_uids, merge_doctrees, get_ratio -from sphinx.util.pycompat import all from util import test_root, TestApp diff --git a/tests/test_websupport.py b/tests/test_websupport.py index 611a131a..d950a36c 100644 --- a/tests/test_websupport.py +++ b/tests/test_websupport.py @@ -11,12 +11,7 @@ import os from StringIO import StringIO - -try: - from functools import wraps -except ImportError: - # functools is new in 2.5 - wraps = lambda f: (lambda w: w) +from functools import wraps from sphinx.websupport import WebSupport from sphinx.websupport.errors import DocumentNotFoundError, \ diff --git a/tests/util.py b/tests/util.py index 4ba89030..a2f345bf 100644 --- a/tests/util.py +++ b/tests/util.py @@ -13,12 +13,7 @@ import tempfile import shutil import re from codecs import open - -try: - from functools import wraps -except ImportError: - # functools is new in 2.4 - wraps = lambda f: (lambda w: w) +from functools import wraps from sphinx import application from sphinx.theming import Theme |
