mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix flake8 violations
This commit is contained in:
parent
832f537703
commit
56d3458584
@ -26,7 +26,7 @@ universal = 1
|
|||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 95
|
max-line-length = 95
|
||||||
ignore = E116,E241,E251
|
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]
|
[build_sphinx]
|
||||||
warning-is-error = 1
|
warning-is-error = 1
|
||||||
|
@ -129,6 +129,7 @@ def test_pep_0420_disabled_top_level_verify(make_app, apidoc):
|
|||||||
print(app._status.getvalue())
|
print(app._status.getvalue())
|
||||||
print(app._warning.getvalue())
|
print(app._warning.getvalue())
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.apidoc(
|
@pytest.mark.apidoc(
|
||||||
coderoot=(rootdir / 'roots' / 'test-apidoc-trailing-underscore'))
|
coderoot=(rootdir / 'roots' / 'test-apidoc-trailing-underscore'))
|
||||||
def test_trailing_underscore(make_app, apidoc):
|
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_ package\n" in rst
|
||||||
assert "package_.module_ module\n" in rst
|
assert "package_.module_ module\n" in rst
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.apidoc(
|
@pytest.mark.apidoc(
|
||||||
coderoot=(rootdir / 'root'),
|
coderoot=(rootdir / 'root'),
|
||||||
options=[
|
options=[
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
|
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
|
||||||
:license: BSD, see LICENSE for details.
|
:license: BSD, see LICENSE for details.
|
||||||
"""
|
"""
|
||||||
import codecs
|
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
|
||||||
from sphinx.application import ExtensionError
|
from sphinx.application import ExtensionError
|
||||||
|
@ -448,11 +448,13 @@ def test_html_output(app, cached_etree_parse, fname, expect):
|
|||||||
app.build()
|
app.build()
|
||||||
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
|
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('html', testroot='build-html-translator')
|
@pytest.mark.sphinx('html', testroot='build-html-translator')
|
||||||
def test_html_translator(app):
|
def test_html_translator(app):
|
||||||
app.build()
|
app.build()
|
||||||
assert app.builder.docwriter.visitor.depart_with_node == 10
|
assert app.builder.docwriter.visitor.depart_with_node == 10
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||||
'index.html': [
|
'index.html': [
|
||||||
(".//li[@class='toctree-l3']/a", '1.1.1. Foo A1', True),
|
(".//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({
|
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||||
'index.html': [
|
'index.html': [
|
||||||
(".//link[@href='_static/persistent.css']"
|
(".//link[@href='_static/persistent.css']"
|
||||||
"[@rel='stylesheet']", '', True),
|
"[@rel='stylesheet']", '', True),
|
||||||
(".//link[@href='_static/default.css']"
|
(".//link[@href='_static/default.css']"
|
||||||
"[@rel='stylesheet']"
|
"[@rel='stylesheet']"
|
||||||
"[@title='Default']", '', True),
|
"[@title='Default']", '', True),
|
||||||
(".//link[@href='_static/alternate1.css']"
|
(".//link[@href='_static/alternate1.css']"
|
||||||
"[@rel='alternate stylesheet']"
|
"[@rel='alternate stylesheet']"
|
||||||
"[@title='Alternate']", '', True),
|
"[@title='Alternate']", '', True),
|
||||||
(".//link[@href='_static/alternate2.css']"
|
(".//link[@href='_static/alternate2.css']"
|
||||||
"[@rel='alternate stylesheet']", '', True),
|
"[@rel='alternate stylesheet']", '', True),
|
||||||
(".//link[@href='_static/more_persistent.css']"
|
(".//link[@href='_static/more_persistent.css']"
|
||||||
"[@rel='stylesheet']", '', True),
|
"[@rel='stylesheet']", '', True),
|
||||||
(".//link[@href='_static/more_default.css']"
|
(".//link[@href='_static/more_default.css']"
|
||||||
"[@rel='stylesheet']"
|
"[@rel='stylesheet']"
|
||||||
"[@title='Default']", '', True),
|
"[@title='Default']", '', True),
|
||||||
(".//link[@href='_static/more_alternate1.css']"
|
(".//link[@href='_static/more_alternate1.css']"
|
||||||
"[@rel='alternate stylesheet']"
|
"[@rel='alternate stylesheet']"
|
||||||
"[@title='Alternate']", '', True),
|
"[@title='Alternate']", '', True),
|
||||||
(".//link[@href='_static/more_alternate2.css']"
|
(".//link[@href='_static/more_alternate2.css']"
|
||||||
"[@rel='alternate stylesheet']", '', True),
|
"[@rel='alternate stylesheet']", '', True),
|
||||||
],
|
],
|
||||||
}))
|
}))
|
||||||
@pytest.mark.sphinx('html', testroot='stylesheets')
|
@pytest.mark.sphinx('html', testroot='stylesheets')
|
||||||
|
@ -14,19 +14,14 @@
|
|||||||
:license: BSD, see LICENSE for details.
|
:license: BSD, see LICENSE for details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
from itertools import cycle, chain
|
|
||||||
import xml.etree.cElementTree as ElementTree
|
import xml.etree.cElementTree as ElementTree
|
||||||
|
|
||||||
from six import PY3
|
|
||||||
import pytest
|
import pytest
|
||||||
from html5lib import getTreeBuilder, HTMLParser
|
from html5lib import getTreeBuilder, HTMLParser
|
||||||
|
|
||||||
from sphinx import __display_version__
|
|
||||||
from sphinx.util.docutils import is_html5_writer_available
|
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
|
from test_build_html import flat_dict, tail_check, check_xpath
|
||||||
|
|
||||||
TREE_BUILDER = getTreeBuilder('etree', implementation=ElementTree)
|
TREE_BUILDER = getTreeBuilder('etree', implementation=ElementTree)
|
||||||
@ -35,6 +30,7 @@ HTML_PARSER = HTMLParser(TREE_BUILDER, namespaceHTMLElements=False)
|
|||||||
|
|
||||||
etree_cache = {}
|
etree_cache = {}
|
||||||
|
|
||||||
|
|
||||||
@skip_unless(is_html5_writer_available())
|
@skip_unless(is_html5_writer_available())
|
||||||
@pytest.fixture(scope='module')
|
@pytest.fixture(scope='module')
|
||||||
def cached_etree_parse():
|
def cached_etree_parse():
|
||||||
|
@ -517,4 +517,3 @@ def test_literalinclude_pydecorators(app, status, warning):
|
|||||||
' pass\n'
|
' pass\n'
|
||||||
)
|
)
|
||||||
assert actual == expect
|
assert actual == expect
|
||||||
|
|
||||||
|
@ -451,6 +451,7 @@ def test_templates():
|
|||||||
check('concept', 'template<typename ...Pack> Numerics = (... && Numeric<Pack>)',
|
check('concept', 'template<typename ...Pack> Numerics = (... && Numeric<Pack>)',
|
||||||
None, 'IDpE8Numerics')
|
None, 'IDpE8Numerics')
|
||||||
|
|
||||||
|
|
||||||
def test_template_args():
|
def test_template_args():
|
||||||
# from breathe#218
|
# from breathe#218
|
||||||
check('function',
|
check('function',
|
||||||
@ -462,6 +463,7 @@ def test_template_args():
|
|||||||
"enable_if_not_array_t = std::enable_if_t<!is_array<T>::value, int>",
|
"enable_if_not_array_t = std::enable_if_t<!is_array<T>::value, int>",
|
||||||
None, "I0E21enable_if_not_array_t")
|
None, "I0E21enable_if_not_array_t")
|
||||||
|
|
||||||
|
|
||||||
def test_attributes():
|
def test_attributes():
|
||||||
# style: C++
|
# style: C++
|
||||||
check('member', '[[]] int f', 'f__i', '1f')
|
check('member', '[[]] int f', 'f__i', '1f')
|
||||||
|
@ -122,21 +122,21 @@ def test_domain_js_find_obj(app, status, warning):
|
|||||||
assert (find_obj(None, None, u'NONEXISTANT', u'class') ==
|
assert (find_obj(None, None, u'NONEXISTANT', u'class') ==
|
||||||
(None, None))
|
(None, None))
|
||||||
assert (find_obj(None, None, u'NestedParentA', u'class') ==
|
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') ==
|
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') ==
|
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') ==
|
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') ==
|
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') ==
|
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') ==
|
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') ==
|
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():
|
def test_get_full_qualified_name():
|
||||||
|
@ -106,16 +106,16 @@ def test_get_items_summary(app, status, warning):
|
|||||||
'dummy_module.func')
|
'dummy_module.func')
|
||||||
assert autosummary_items['func'] == func_attrs
|
assert autosummary_items['func'] == func_attrs
|
||||||
|
|
||||||
|
|
||||||
def str_content(elem):
|
def str_content(elem):
|
||||||
if elem.text is not None:
|
if elem.text is not None:
|
||||||
return elem.text
|
return elem.text
|
||||||
else:
|
else:
|
||||||
return ''.join(str_content(e) for e in elem)
|
return ''.join(str_content(e) for e in elem)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('xml', **default_kw)
|
@pytest.mark.sphinx('xml', **default_kw)
|
||||||
def test_escaping(app, status, warning):
|
def test_escaping(app, status, warning):
|
||||||
from xml.etree import ElementTree
|
|
||||||
|
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
|
|
||||||
outdir = app.builder.outdir
|
outdir = app.builder.outdir
|
||||||
|
@ -17,6 +17,7 @@ import pytest
|
|||||||
|
|
||||||
from sphinx.util import inspect
|
from sphinx.util import inspect
|
||||||
|
|
||||||
|
|
||||||
class TestGetArgSpec(TestCase):
|
class TestGetArgSpec(TestCase):
|
||||||
def test_getargspec_builtin_type(self):
|
def test_getargspec_builtin_type(self):
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
|
Loading…
Reference in New Issue
Block a user