diff options
Diffstat (limited to 'tests')
29 files changed, 52 insertions, 56 deletions
diff --git a/tests/roots/test-intl/conf.py b/tests/roots/test-intl/conf.py index 59ce714d9..4c37f7718 100644 --- a/tests/roots/test-intl/conf.py +++ b/tests/roots/test-intl/conf.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- -import sys, os - project = 'Sphinx intl <Tests>' source_suffix = '.txt' keep_warnings = True diff --git a/tests/test_application.py b/tests/test_application.py index 87ec42f01..a0a288b93 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -15,7 +15,7 @@ from docutils import nodes from sphinx.application import ExtensionError from sphinx.domains import Domain -from util import * +from util import with_app, raises_msg, TestApp @with_app() diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index fdc8d5f7f..769827d33 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -13,7 +13,7 @@ import sys from StringIO import StringIO -from util import * +from util import TestApp, Struct from nose.tools import with_setup from docutils.statemachine import ViewList @@ -21,6 +21,7 @@ from docutils.statemachine import ViewList from sphinx.ext.autodoc import AutoDirective, add_documenter, \ ModuleLevelDocumenter, FunctionDocumenter, cut_lines, between, ALL +app = None def setup_module(): global app @@ -36,6 +37,8 @@ def teardown_module(): app.cleanup() +directive = options = None + def setup_test(): global options, directive global processed_docstrings, processed_signatures, _warnings diff --git a/tests/test_autosummary.py b/tests/test_autosummary.py index dab72c1e5..cb6a6b745 100644 --- a/tests/test_autosummary.py +++ b/tests/test_autosummary.py @@ -9,8 +9,6 @@ :license: BSD, see LICENSE for details. """ -from util import * - from sphinx.ext.autosummary import mangle_signature diff --git a/tests/test_build.py b/tests/test_build.py index c2f0b38d1..b172184b1 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -9,7 +9,7 @@ :license: BSD, see LICENSE for details. """ -from util import * +from util import with_app, test_root, path from textwrap import dedent diff --git a/tests/test_build_gettext.py b/tests/test_build_gettext.py index 831ef29d2..bba3461b8 100644 --- a/tests/test_build_gettext.py +++ b/tests/test_build_gettext.py @@ -14,8 +14,7 @@ import os import re from subprocess import Popen, PIPE -from util import * -from util import SkipTest +from util import test_root, test_roots, with_app, SkipTest def teardown_module(): diff --git a/tests/test_build_html.py b/tests/test_build_html.py index 616b67f9e..3890f6e1b 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -21,7 +21,7 @@ except ImportError: pygments = None from sphinx import __version__ -from util import * +from util import test_root, remove_unicode_literals, gen_with_app from etree13 import ElementTree as ET diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index b7e21077b..bb79e52cf 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -17,8 +17,7 @@ from subprocess import Popen, PIPE from sphinx.writers.latex import LaTeXTranslator -from util import * -from util import SkipTest +from util import test_root, SkipTest, remove_unicode_literals, with_app from test_build_html import ENV_WARNINGS diff --git a/tests/test_build_texinfo.py b/tests/test_build_texinfo.py index 37ad0582a..587d123b9 100644 --- a/tests/test_build_texinfo.py +++ b/tests/test_build_texinfo.py @@ -17,7 +17,7 @@ from subprocess import Popen, PIPE from sphinx.writers.texinfo import TexinfoTranslator -from util import * +from util import with_app, test_root, remove_unicode_literals from test_build_html import ENV_WARNINGS diff --git a/tests/test_build_text.py b/tests/test_build_text.py index 41603d502..445e39db6 100644 --- a/tests/test_build_text.py +++ b/tests/test_build_text.py @@ -9,12 +9,10 @@ :license: BSD, see LICENSE for details. """ -from textwrap import dedent - from docutils.utils import column_width from sphinx.writers.text import MAXWIDTH -from util import * +from util import with_app def with_text_app(*args, **kw): diff --git a/tests/test_config.py b/tests/test_config.py index 84a3b4b77..4d3d51b09 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -11,9 +11,8 @@ """ import sys -from util import * +from util import TestApp, with_app, with_tempdir, raises, raises_msg, write_file -import sphinx from sphinx.config import Config from sphinx.errors import ExtensionError, ConfigError, VersionRequirementError from sphinx.util.pycompat import b diff --git a/tests/test_coverage.py b/tests/test_coverage.py index 88c66140f..6ba005429 100644 --- a/tests/test_coverage.py +++ b/tests/test_coverage.py @@ -11,7 +11,7 @@ import pickle -from util import * +from util import with_app @with_app(buildername='coverage') diff --git a/tests/test_cpp_domain.py b/tests/test_cpp_domain.py index db2589d50..2168d7e44 100644 --- a/tests/test_cpp_domain.py +++ b/tests/test_cpp_domain.py @@ -9,7 +9,7 @@ :license: BSD, see LICENSE for details. """ -from util import * +from util import raises from sphinx.domains.cpp import DefinitionParser, DefinitionError diff --git a/tests/test_doctest.py b/tests/test_doctest.py index 4934e716b..f445dab2a 100644 --- a/tests/test_doctest.py +++ b/tests/test_doctest.py @@ -12,7 +12,8 @@ import sys import StringIO -from util import * +from util import with_app + status = StringIO.StringIO() cleanup_called = 0 diff --git a/tests/test_env.py b/tests/test_env.py index 12e0719da..2b03bbfb9 100644 --- a/tests/test_env.py +++ b/tests/test_env.py @@ -10,7 +10,7 @@ """ import sys -from util import * +from util import TestApp, remove_unicode_literals, path from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.builders.latex import LaTeXBuilder diff --git a/tests/test_footnote.py b/tests/test_footnote.py index 3a3d59670..ae8e76d8a 100644 --- a/tests/test_footnote.py +++ b/tests/test_footnote.py @@ -11,7 +11,7 @@ import re -from util import * +from util import test_root, with_app def teardown_module(): diff --git a/tests/test_highlighting.py b/tests/test_highlighting.py index b392193d6..888d4c214 100644 --- a/tests/test_highlighting.py +++ b/tests/test_highlighting.py @@ -9,20 +9,19 @@ :license: BSD, see LICENSE for details. """ -from util import * - -try: - import pygments -except ImportError: - from nose.plugins.skip import SkipTest - raise SkipTest('pygments not available') - from pygments.lexer import RegexLexer from pygments.token import Text, Name from pygments.formatters.html import HtmlFormatter from sphinx.highlighting import PygmentsBridge +from util import with_app, SkipTest + +try: + import pygments +except ImportError: + raise SkipTest('pygments not available') + class MyLexer(RegexLexer): name = 'testlexer' diff --git a/tests/test_i18n.py b/tests/test_i18n.py index 210243e79..e67c96c78 100644 --- a/tests/test_i18n.py +++ b/tests/test_i18n.py @@ -9,7 +9,7 @@ :license: BSD, see LICENSE for details. """ -from util import * +from util import with_app @with_app(confoverrides={'language': 'de'}) diff --git a/tests/test_intersphinx.py b/tests/test_intersphinx.py index 0171ae035..a8679e7e2 100644 --- a/tests/test_intersphinx.py +++ b/tests/test_intersphinx.py @@ -22,7 +22,7 @@ from sphinx import addnodes from sphinx.ext.intersphinx import read_inventory_v1, read_inventory_v2, \ load_mappings, missing_reference -from util import * +from util import with_app, with_tempdir, write_file inventory_v1 = '''\ @@ -178,5 +178,3 @@ def test_load_mappings_warnings(tempdir, app): # load the inventory and check if it's done correctly load_mappings(app) assert len(app._warning.content) == 2 - - diff --git a/tests/test_intl.py b/tests/test_intl.py index 4a74e030e..fe152c831 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -10,15 +10,14 @@ :license: BSD, see LICENSE for details. """ -from subprocess import Popen, PIPE -import re import os +import re from StringIO import StringIO +from subprocess import Popen, PIPE from sphinx.util.pycompat import relpath -from util import * -from util import SkipTest +from util import test_roots, path, with_app, SkipTest warnfile = StringIO() diff --git a/tests/test_linkcode.py b/tests/test_linkcode.py index 6e9bd6f87..507cd9ce9 100644 --- a/tests/test_linkcode.py +++ b/tests/test_linkcode.py @@ -10,7 +10,7 @@ """ import os -from util import * +from util import with_app @with_app(srcdir='(temp)', buildername='html', tags=['test_linkcode']) def test_html(app): diff --git a/tests/test_markup.py b/tests/test_markup.py index c72b6b913..311222ba1 100644 --- a/tests/test_markup.py +++ b/tests/test_markup.py @@ -11,8 +11,6 @@ import re -from util import * - from docutils import frontend, utils, nodes from docutils.parsers import rst @@ -21,6 +19,11 @@ from sphinx.util.pycompat import b from sphinx.writers.html import HTMLWriter, SmartyPantsHTMLTranslator from sphinx.writers.latex import LaTeXWriter, LaTeXTranslator +from util import TestApp + + +app = settings = parser = None + def setup_module(): global app, settings, parser texescape.init() # otherwise done by the latex builder diff --git a/tests/test_metadata.py b/tests/test_metadata.py index b4a064baf..db955390d 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -12,7 +12,7 @@ # adapted from an example of bibliographic metadata at # http://docutils.sourceforge.net/docs/user/rst/demo.txt -from util import * +from util import TestApp from nose.tools import assert_equals diff --git a/tests/test_only_directive.py b/tests/test_only_directive.py index af1462c03..e29202e00 100644 --- a/tests/test_only_directive.py +++ b/tests/test_only_directive.py @@ -13,7 +13,7 @@ import re from docutils import nodes -from util import * +from util import with_app, test_roots def teardown_module(): diff --git a/tests/test_quickstart.py b/tests/test_quickstart.py index b0815447d..2340e04b7 100644 --- a/tests/test_quickstart.py +++ b/tests/test_quickstart.py @@ -12,7 +12,7 @@ import sys import time -from util import * +from util import raises, with_tempdir from sphinx import quickstart as qs from sphinx.util.console import nocolor, coloron diff --git a/tests/test_searchadapters.py b/tests/test_searchadapters.py index 551eefb9e..ad1e58f2b 100644 --- a/tests/test_searchadapters.py +++ b/tests/test_searchadapters.py @@ -9,15 +9,13 @@ :license: BSD, see LICENSE for details. """ -import os, sys +import os from StringIO import StringIO -from nose import SkipTest - from sphinx.websupport import WebSupport from test_websupport import sqlalchemy_missing -from util import * +from util import test_root, skip_if, skip_unless_importable def clear_builddir(): diff --git a/tests/test_theming.py b/tests/test_theming.py index 141aa0889..2e297aedc 100644 --- a/tests/test_theming.py +++ b/tests/test_theming.py @@ -12,10 +12,10 @@ import os import zipfile -from util import * - from sphinx.theming import Theme, ThemeError +from util import with_app, raises + @with_app(confoverrides={'html_theme': 'ziptheme', 'html_theme_options.testopt': 'foo'}) diff --git a/tests/test_versioning.py b/tests/test_versioning.py index 08238f4a1..6469a33cc 100644 --- a/tests/test_versioning.py +++ b/tests/test_versioning.py @@ -8,17 +8,20 @@ :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ -import pickle -from util import * +import pickle -from docutils.statemachine import ViewList 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 + + +app = original = original_uids = None + def setup_module(): global app, original, original_uids app = TestApp() diff --git a/tests/test_websupport.py b/tests/test_websupport.py index ff9fb1ecb..611a131ac 100644 --- a/tests/test_websupport.py +++ b/tests/test_websupport.py @@ -19,7 +19,8 @@ except ImportError: wraps = lambda f: (lambda w: w) from sphinx.websupport import WebSupport -from sphinx.websupport.errors import * +from sphinx.websupport.errors import DocumentNotFoundError, \ + CommentNotAllowedError, UserNotAuthorizedError from sphinx.websupport.storage import StorageBackend from sphinx.websupport.storage.differ import CombinedHtmlDiff try: @@ -30,7 +31,7 @@ try: except ImportError: sqlalchemy_missing = True -from util import * +from util import test_root, raises, skip_if default_settings = {'builddir': os.path.join(test_root, 'websupport'), |