Fix flake8 violations

This commit is contained in:
Takeshi KOMIYA 2017-05-09 21:57:36 +09:00
parent 832f537703
commit 56d3458584
10 changed files with 32 additions and 32 deletions

View File

@ -26,7 +26,7 @@ universal = 1
[flake8]
max-line-length = 95
ignore = E116,E241,E251
exclude = .git,.tox,tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py
exclude = .git,.tox,tests/etree13/*,tests/root/*,tests/roots/*,tests/py35/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py
[build_sphinx]
warning-is-error = 1

View File

@ -129,6 +129,7 @@ def test_pep_0420_disabled_top_level_verify(make_app, apidoc):
print(app._status.getvalue())
print(app._warning.getvalue())
@pytest.mark.apidoc(
coderoot=(rootdir / 'roots' / 'test-apidoc-trailing-underscore'))
def test_trailing_underscore(make_app, apidoc):
@ -147,6 +148,7 @@ def test_trailing_underscore(make_app, apidoc):
assert "package_ package\n" in rst
assert "package_.module_ module\n" in rst
@pytest.mark.apidoc(
coderoot=(rootdir / 'root'),
options=[

View File

@ -8,8 +8,6 @@
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import codecs
from docutils import nodes
from sphinx.application import ExtensionError

View File

@ -448,11 +448,13 @@ def test_html_output(app, cached_etree_parse, fname, expect):
app.build()
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
@pytest.mark.sphinx('html', testroot='build-html-translator')
def test_html_translator(app):
app.build()
assert app.builder.docwriter.visitor.depart_with_node == 10
@pytest.mark.parametrize("fname,expect", flat_dict({
'index.html': [
(".//li[@class='toctree-l3']/a", '1.1.1. Foo A1', True),
@ -1205,25 +1207,25 @@ def test_html_raw_directive(app, status, warning):
@pytest.mark.parametrize("fname,expect", flat_dict({
'index.html': [
(".//link[@href='_static/persistent.css']"
"[@rel='stylesheet']", '', True),
"[@rel='stylesheet']", '', True),
(".//link[@href='_static/default.css']"
"[@rel='stylesheet']"
"[@title='Default']", '', True),
"[@rel='stylesheet']"
"[@title='Default']", '', True),
(".//link[@href='_static/alternate1.css']"
"[@rel='alternate stylesheet']"
"[@title='Alternate']", '', True),
"[@rel='alternate stylesheet']"
"[@title='Alternate']", '', True),
(".//link[@href='_static/alternate2.css']"
"[@rel='alternate stylesheet']", '', True),
"[@rel='alternate stylesheet']", '', True),
(".//link[@href='_static/more_persistent.css']"
"[@rel='stylesheet']", '', True),
"[@rel='stylesheet']", '', True),
(".//link[@href='_static/more_default.css']"
"[@rel='stylesheet']"
"[@title='Default']", '', True),
"[@rel='stylesheet']"
"[@title='Default']", '', True),
(".//link[@href='_static/more_alternate1.css']"
"[@rel='alternate stylesheet']"
"[@title='Alternate']", '', True),
"[@rel='alternate stylesheet']"
"[@title='Alternate']", '', True),
(".//link[@href='_static/more_alternate2.css']"
"[@rel='alternate stylesheet']", '', True),
"[@rel='alternate stylesheet']", '', True),
],
}))
@pytest.mark.sphinx('html', testroot='stylesheets')

View File

@ -14,19 +14,14 @@
:license: BSD, see LICENSE for details.
"""
import os
import re
from itertools import cycle, chain
import xml.etree.cElementTree as ElementTree
from six import PY3
import pytest
from html5lib import getTreeBuilder, HTMLParser
from sphinx import __display_version__
from sphinx.util.docutils import is_html5_writer_available
from util import remove_unicode_literals, strip_escseq, skip_unless
from util import skip_unless
from test_build_html import flat_dict, tail_check, check_xpath
TREE_BUILDER = getTreeBuilder('etree', implementation=ElementTree)
@ -35,6 +30,7 @@ HTML_PARSER = HTMLParser(TREE_BUILDER, namespaceHTMLElements=False)
etree_cache = {}
@skip_unless(is_html5_writer_available())
@pytest.fixture(scope='module')
def cached_etree_parse():

View File

@ -517,4 +517,3 @@ def test_literalinclude_pydecorators(app, status, warning):
' pass\n'
)
assert actual == expect

View File

@ -451,6 +451,7 @@ def test_templates():
check('concept', 'template<typename ...Pack> Numerics = (... && Numeric<Pack>)',
None, 'IDpE8Numerics')
def test_template_args():
# from breathe#218
check('function',
@ -462,6 +463,7 @@ def test_template_args():
"enable_if_not_array_t = std::enable_if_t<!is_array<T>::value, int>",
None, "I0E21enable_if_not_array_t")
def test_attributes():
# style: C++
check('member', '[[]] int f', 'f__i', '1f')

View File

@ -122,21 +122,21 @@ def test_domain_js_find_obj(app, status, warning):
assert (find_obj(None, None, u'NONEXISTANT', u'class') ==
(None, None))
assert (find_obj(None, None, u'NestedParentA', u'class') ==
( u'NestedParentA', (u'roles', u'class')))
(u'NestedParentA', (u'roles', u'class')))
assert (find_obj(None, None, u'NestedParentA.NestedChildA', u'class') ==
( u'NestedParentA.NestedChildA', (u'roles', u'class')))
(u'NestedParentA.NestedChildA', (u'roles', u'class')))
assert (find_obj(None, 'NestedParentA', u'NestedChildA', u'class') ==
( u'NestedParentA.NestedChildA', (u'roles', u'class')))
(u'NestedParentA.NestedChildA', (u'roles', u'class')))
assert (find_obj(None, None, u'NestedParentA.NestedChildA.subchild_1', u'func') ==
( u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
(u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
assert (find_obj(None, u'NestedParentA', u'NestedChildA.subchild_1', u'func') ==
( u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
(u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
assert (find_obj(None, u'NestedParentA.NestedChildA', u'subchild_1', u'func') ==
( u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
(u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
assert (find_obj(u'module_a.submodule', u'ModTopLevel', u'mod_child_2', u'meth') ==
( u'module_a.submodule.ModTopLevel.mod_child_2', (u'module', u'method')))
(u'module_a.submodule.ModTopLevel.mod_child_2', (u'module', u'method')))
assert (find_obj(u'module_b.submodule', u'ModTopLevel', u'module_a.submodule', u'mod') ==
( u'module_a.submodule', (u'module', u'module')))
(u'module_a.submodule', (u'module', u'module')))
def test_get_full_qualified_name():

View File

@ -106,16 +106,16 @@ def test_get_items_summary(app, status, warning):
'dummy_module.func')
assert autosummary_items['func'] == func_attrs
def str_content(elem):
if elem.text is not None:
return elem.text
else:
return ''.join(str_content(e) for e in elem)
@pytest.mark.sphinx('xml', **default_kw)
def test_escaping(app, status, warning):
from xml.etree import ElementTree
app.builder.build_all()
outdir = app.builder.outdir

View File

@ -17,6 +17,7 @@ import pytest
from sphinx.util import inspect
class TestGetArgSpec(TestCase):
def test_getargspec_builtin_type(self):
with pytest.raises(TypeError):