diff --git a/_pytest/_code/source.py b/_pytest/_code/source.py index b17d15659..f86d96c9c 100644 --- a/_pytest/_code/source.py +++ b/_pytest/_code/source.py @@ -198,8 +198,7 @@ class Source(object): # public API shortcut functions # -def compile_(source, filename=None, mode='exec', flags= - generators.compiler_flag, dont_inherit=0): +def compile_(source, filename=None, mode='exec', flags=generators.compiler_flag, dont_inherit=0): """ compile the given source to a raw code object, and maintain an internal cache which allows later retrieval of the source code for the code object diff --git a/_pytest/helpconfig.py b/_pytest/helpconfig.py index d5fee5d54..320eb4ab6 100644 --- a/_pytest/helpconfig.py +++ b/_pytest/helpconfig.py @@ -44,7 +44,7 @@ def pytest_addoption(parser): help="display pytest lib version and import information.") group._addoption("-h", "--help", action=HelpAction, dest="help", help="show help message and configuration info") - group._addoption('-p', action="append", dest="plugins", default = [], + group._addoption('-p', action="append", dest="plugins", default=[], metavar="name", help="early-load given plugin (multi-allowed). " "To avoid loading of plugins, use the `no:` prefix, e.g. " diff --git a/_pytest/pytester.py b/_pytest/pytester.py index 3c3a0d3b7..46a273dbb 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -871,7 +871,7 @@ class Testdir: kw = {self.request.function.__name__: Source(source).strip()} path = self.makepyfile(**kw) if withinit: - self.makepyfile(__init__ = "#") + self.makepyfile(__init__="#") self.config = config = self.parseconfigure(path, *configargs) node = self.getnode(config, path) diff --git a/_pytest/python.py b/_pytest/python.py index f63d6bbc4..56ad8ea3e 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -176,8 +176,7 @@ def pytest_pycollect_makeitem(collector, name, obj): # or a funtools.wrapped. # We musn't if it's been wrapped with mock.patch (python 2 only) if not (isfunction(obj) or isfunction(get_real_func(obj))): - collector.warn(code="C2", message= - "cannot collect %r because it is not a function." + collector.warn(code="C2", message="cannot collect %r because it is not a function." % name, ) elif getattr(obj, "__test__", True): if is_generator(obj): diff --git a/testing/test_config.py b/testing/test_config.py index 463c2edd7..283155e6c 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -99,7 +99,7 @@ class TestConfigCmdlineParsing(object): [pytest] custom = 0 """) - testdir.makefile(".cfg", custom = """ + testdir.makefile(".cfg", custom=""" [pytest] custom = 1 """) diff --git a/testing/test_parseopt.py b/testing/test_parseopt.py index ccc951d66..3e3919a38 100644 --- a/testing/test_parseopt.py +++ b/testing/test_parseopt.py @@ -238,7 +238,7 @@ class TestParser(object): assert args.file_or_dir == ['abcd'] def test_drop_short_help0(self, parser, capsys): - parser.addoption('--func-args', '--doit', help = 'foo', + parser.addoption('--func-args', '--doit', help='foo', action='store_true') parser.parse([]) help = parser.optparser.format_help() diff --git a/testing/test_resultlog.py b/testing/test_resultlog.py index a8f83d567..7bbaa458c 100644 --- a/testing/test_resultlog.py +++ b/testing/test_resultlog.py @@ -16,8 +16,8 @@ def test_generic_path(testdir): p1 = Node('a', config=config, session=session) #assert p1.fspath is None p2 = Node('B', parent=p1) - p3 = Node('()', parent = p2) - item = Item('c', parent = p3) + p3 = Node('()', parent=p2) + item = Item('c', parent=p3) res = generic_path(item) assert res == 'a.B().c' @@ -25,9 +25,9 @@ def test_generic_path(testdir): p0 = FSCollector('proj/test', config=config, session=session) p1 = FSCollector('proj/test/a', parent=p0) p2 = Node('B', parent=p1) - p3 = Node('()', parent = p2) + p3 = Node('()', parent=p2) p4 = Node('c', parent=p3) - item = Item('[1]', parent = p4) + item = Item('[1]', parent=p4) res = generic_path(item) assert res == 'test/a:B().c[1]' diff --git a/testing/test_skipping.py b/testing/test_skipping.py index 606560f4c..7e101f88c 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -699,7 +699,7 @@ def test_skipped_reasons_functional(testdir): def test_method(self): doskip() """, - conftest = """ + conftest=""" import pytest def doskip(): pytest.skip('test') diff --git a/testing/test_terminal.py b/testing/test_terminal.py index a03d54af4..66e909fe1 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -38,7 +38,7 @@ def pytest_generate_tests(metafunc): metafunc.addcall(id="verbose", funcargs={'option': Option(verbose=True)}) metafunc.addcall(id="quiet", - funcargs={'option': Option(verbose= -1)}) + funcargs={'option': Option(verbose=-1)}) metafunc.addcall(id="fulltrace", funcargs={'option': Option(fulltrace=True)}) diff --git a/tox.ini b/tox.ini index 3969897e7..68302e315 100644 --- a/tox.ini +++ b/tox.ini @@ -196,6 +196,6 @@ filterwarnings = ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning [flake8] -ignore = E251,E261,E262,E265,E271,E272,E293,E301,E302,E303,E401,E402,E501,E701,E702,E704,E712,E731 +ignore = E261,E262,E265,E271,E272,E293,E301,E302,E303,E401,E402,E501,E701,E702,E704,E712,E731 max-line-length = 120 exclude = _pytest/vendored_packages/pluggy.py