Fixed E127 flake8 errors

continuation line over-indented for visual indent
This commit is contained in:
Andras Tim 2017-07-17 01:25:07 +02:00
parent e855a79dd4
commit 57438f3efe
12 changed files with 13 additions and 13 deletions

View File

@ -723,7 +723,7 @@ class AssertionRewriter(ast.NodeVisitor):
if isinstance(assert_.test, ast.Tuple) and self.config is not None: if isinstance(assert_.test, ast.Tuple) and self.config is not None:
fslocation = (self.module_path, assert_.lineno) fslocation = (self.module_path, assert_.lineno)
self.config.warn('R1', 'assertion is always true, perhaps ' self.config.warn('R1', 'assertion is always true, perhaps '
'remove parentheses?', fslocation=fslocation) 'remove parentheses?', fslocation=fslocation)
self.statements = [] self.statements = []
self.variables = [] self.variables = []
self.variable_counter = itertools.count() self.variable_counter = itertools.count()

View File

@ -79,7 +79,7 @@ def num_mock_patch_args(function):
mock = sys.modules.get("mock", sys.modules.get("unittest.mock", None)) mock = sys.modules.get("mock", sys.modules.get("unittest.mock", None))
if mock is not None: if mock is not None:
return len([p for p in patchings return len([p for p in patchings
if not p.attribute_name and p.new is mock.DEFAULT]) if not p.attribute_name and p.new is mock.DEFAULT])
return len(patchings) return len(patchings)

View File

@ -304,7 +304,7 @@ class PytestPluginManager(PluginManager):
""" """
current = py.path.local() current = py.path.local()
self._confcutdir = current.join(namespace.confcutdir, abs=True) \ self._confcutdir = current.join(namespace.confcutdir, abs=True) \
if namespace.confcutdir else None if namespace.confcutdir else None
self._noconftest = namespace.noconftest self._noconftest = namespace.noconftest
testpaths = namespace.file_or_dir testpaths = namespace.file_or_dir
foundanchor = False foundanchor = False

View File

@ -132,7 +132,7 @@ class DoctestItem(pytest.Item):
else: else:
inner_excinfo = ExceptionInfo(excinfo.value.exc_info) inner_excinfo = ExceptionInfo(excinfo.value.exc_info)
lines += ["UNEXPECTED EXCEPTION: %s" % lines += ["UNEXPECTED EXCEPTION: %s" %
repr(inner_excinfo.value)] repr(inner_excinfo.value)]
lines += traceback.format_exception(*excinfo.value.exc_info) lines += traceback.format_exception(*excinfo.value.exc_info)
return ReprFailDoctest(reprlocation, lines) return ReprFailDoctest(reprlocation, lines)
else: else:

View File

@ -378,8 +378,8 @@ class LogXML(object):
close_report = next( close_report = next(
(rep for rep in self.open_reports (rep for rep in self.open_reports
if (rep.nodeid == report.nodeid and if (rep.nodeid == report.nodeid and
getattr(rep, "item_index", None) == report_ii and getattr(rep, "item_index", None) == report_ii and
getattr(rep, "worker_id", None) == report_wid getattr(rep, "worker_id", None) == report_wid
) )
), None) ), None)
if close_report: if close_report:

View File

@ -31,7 +31,7 @@ def pytest_addoption(parser):
parser.addoption('--runpytest', default="inprocess", dest="runpytest", parser.addoption('--runpytest', default="inprocess", dest="runpytest",
choices=("inprocess", "subprocess", ), choices=("inprocess", "subprocess", ),
help=("run pytest sub runs in tests using an 'inprocess' " help=("run pytest sub runs in tests using an 'inprocess' "
"or 'subprocess' (python -m main) method")) "or 'subprocess' (python -m main) method"))
def pytest_configure(config): def pytest_configure(config):

View File

@ -904,7 +904,7 @@ def _find_parametrized_scope(argnames, arg2fixturedefs, indirect):
from _pytest.fixtures import scopes from _pytest.fixtures import scopes
indirect_as_list = isinstance(indirect, (list, tuple)) indirect_as_list = isinstance(indirect, (list, tuple))
all_arguments_are_fixtures = indirect is True or \ all_arguments_are_fixtures = indirect is True or \
indirect_as_list and len(indirect) == argnames indirect_as_list and len(indirect) == argnames
if all_arguments_are_fixtures: if all_arguments_are_fixtures:
fixturedefs = arg2fixturedefs or {} fixturedefs = arg2fixturedefs or {}
used_scopes = [fixturedef[0].scope for name, fixturedef in fixturedefs.items()] used_scopes = [fixturedef[0].scope for name, fixturedef in fixturedefs.items()]

View File

@ -339,7 +339,7 @@ def test_excinfo_no_python_sourcecode(tmpdir):
env = jinja2.Environment(loader=loader) env = jinja2.Environment(loader=loader)
template = env.get_template('test.txt') template = env.get_template('test.txt')
excinfo = pytest.raises(ValueError, excinfo = pytest.raises(ValueError,
template.render, h=h) template.render, h=h)
for item in excinfo.traceback: for item in excinfo.traceback:
print(item) #XXX: for some reason jinja.Template.render is printed in full print(item) #XXX: for some reason jinja.Template.render is printed in full
item.source # shouldnt fail item.source # shouldnt fail

View File

@ -173,7 +173,7 @@ class TestMockDecoration(object):
reprec.assertoutcome(passed=2) reprec.assertoutcome(passed=2)
calls = reprec.getcalls("pytest_runtest_logreport") calls = reprec.getcalls("pytest_runtest_logreport")
funcnames = [call.report.location[2] for call in calls funcnames = [call.report.location[2] for call in calls
if call.report.when == "call"] if call.report.when == "call"]
assert funcnames == ["T.test_hello", "test_someting"] assert funcnames == ["T.test_hello", "test_someting"]
def test_mock_sorting(self, testdir): def test_mock_sorting(self, testdir):

View File

@ -460,7 +460,7 @@ class TestSession(object):
("pytest_collectstart", "collector.fspath == test_aaa"), ("pytest_collectstart", "collector.fspath == test_aaa"),
("pytest_pycollect_makeitem", "name == 'test_func'"), ("pytest_pycollect_makeitem", "name == 'test_func'"),
("pytest_collectreport", ("pytest_collectreport",
"report.nodeid.startswith('aaa/test_aaa.py')"), "report.nodeid.startswith('aaa/test_aaa.py')"),
]) ])
def test_collect_two_commandline_args(self, testdir): def test_collect_two_commandline_args(self, testdir):

View File

@ -188,7 +188,7 @@ class TestParser(object):
def test_drop_short_helper(self): def test_drop_short_helper(self):
parser = py.std.argparse.ArgumentParser(formatter_class=parseopt.DropShorterLongHelpFormatter) parser = py.std.argparse.ArgumentParser(formatter_class=parseopt.DropShorterLongHelpFormatter)
parser.add_argument('-t', '--twoword', '--duo', '--two-word', '--two', parser.add_argument('-t', '--twoword', '--duo', '--two-word', '--two',
help='foo').map_long_option = {'two': 'two-word'} help='foo').map_long_option = {'two': 'two-word'}
# throws error on --deux only! # throws error on --deux only!
parser.add_argument('-d', '--deuxmots', '--deux-mots', parser.add_argument('-d', '--deuxmots', '--deux-mots',
action='store_true', help='foo').map_long_option = {'deux': 'deux-mots'} action='store_true', help='foo').map_long_option = {'deux': 'deux-mots'}

View File

@ -196,6 +196,6 @@ filterwarnings =
ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning
[flake8] [flake8]
ignore = E127,E128,E129,E131,E201,E202,E203,E221,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E272,E293,E301,E302,E303,E401,E402,E501,E701,E702,E704,E712,E731 ignore = E128,E129,E131,E201,E202,E203,E221,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E272,E293,E301,E302,E303,E401,E402,E501,E701,E702,E704,E712,E731
max-line-length = 120 max-line-length = 120
exclude = _pytest/vendored_packages/pluggy.py exclude = _pytest/vendored_packages/pluggy.py