tests: replace "from util import *" by explicit imports

This commit is contained in:
Georg Brandl
2013-04-01 11:39:32 +02:00
parent 21f0ca8197
commit 1af3e3ea71
29 changed files with 52 additions and 56 deletions

View File

@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
import sys, os
project = 'Sphinx intl <Tests>'
source_suffix = '.txt'
keep_warnings = True

View File

@@ -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()

View File

@@ -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

View File

@@ -9,8 +9,6 @@
:license: BSD, see LICENSE for details.
"""
from util import *
from sphinx.ext.autosummary import mangle_signature

View File

@@ -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

View File

@@ -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():

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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):

View File

@@ -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

View File

@@ -11,7 +11,7 @@
import pickle
from util import *
from util import with_app
@with_app(buildername='coverage')

View File

@@ -9,7 +9,7 @@
:license: BSD, see LICENSE for details.
"""
from util import *
from util import raises
from sphinx.domains.cpp import DefinitionParser, DefinitionError

View File

@@ -12,7 +12,8 @@
import sys
import StringIO
from util import *
from util import with_app
status = StringIO.StringIO()
cleanup_called = 0

View File

@@ -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

View File

@@ -11,7 +11,7 @@
import re
from util import *
from util import test_root, with_app
def teardown_module():

View File

@@ -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'

View File

@@ -9,7 +9,7 @@
:license: BSD, see LICENSE for details.
"""
from util import *
from util import with_app
@with_app(confoverrides={'language': 'de'})

View File

@@ -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

View File

@@ -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()

View File

@@ -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):

View File

@@ -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

View File

@@ -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

View File

@@ -13,7 +13,7 @@ import re
from docutils import nodes
from util import *
from util import with_app, test_roots
def teardown_module():

View File

@@ -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

View File

@@ -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():

View File

@@ -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'})

View File

@@ -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 *
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()

View File

@@ -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'),