From 6af2abdb53ed5277d7c43bfec0ec646b2a35a814 Mon Sep 17 00:00:00 2001 From: Andras Tim Date: Mon, 17 Jul 2017 01:25:06 +0200 Subject: [PATCH] Fixed flake8 warnings W191 indentation contains tabs W292 no newline at end of file W293 blank line contains whitespace W391 blank line at end of file --- _pytest/_code/code.py | 2 +- _pytest/_code/source.py | 2 -- _pytest/fixtures.py | 1 - testing/code/test_source.py | 5 ++++- testing/freeze/create_executable.py | 1 - testing/freeze/runtests_script.py | 2 +- testing/freeze/tests/test_trivial.py | 2 +- testing/freeze/tox_run.py | 2 +- testing/python/approx.py | 1 - testing/python/fixture.py | 3 --- testing/test_config.py | 1 - testing/test_doctest.py | 1 - testing/test_junitxml.py | 1 - testing/test_pastebin.py | 2 -- testing/test_resultlog.py | 2 -- testing/test_runner.py | 2 -- tox.ini | 2 +- 17 files changed, 9 insertions(+), 23 deletions(-) diff --git a/_pytest/_code/code.py b/_pytest/_code/code.py index 5b7cc4191..03b3c3994 100644 --- a/_pytest/_code/code.py +++ b/_pytest/_code/code.py @@ -645,7 +645,7 @@ class FormattedExcinfo(object): traceback = traceback[:recursionindex + 1] else: extraline = None - + return traceback, extraline def repr_excinfo(self, excinfo): diff --git a/_pytest/_code/source.py b/_pytest/_code/source.py index 8e6148410..93c59cace 100644 --- a/_pytest/_code/source.py +++ b/_pytest/_code/source.py @@ -410,5 +410,3 @@ def getstatementrange_old(lineno, source, assertion=False): if trysource.isparseable(): return start, end raise SyntaxError("no valid source range around line %d " % (lineno,)) - - diff --git a/_pytest/fixtures.py b/_pytest/fixtures.py index 64d21b9f6..f6a4be790 100644 --- a/_pytest/fixtures.py +++ b/_pytest/fixtures.py @@ -1126,4 +1126,3 @@ class FixtureManager: for fixturedef in fixturedefs: if nodeid.startswith(fixturedef.baseid): yield fixturedef - diff --git a/testing/code/test_source.py b/testing/code/test_source.py index bdbc00d19..e456da409 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -325,7 +325,7 @@ def test_getstartingblock_multiline(): self.source = _pytest._code.Frame(frame).statement x = A('x', - 'y' \ + 'y' , 'z') @@ -400,6 +400,7 @@ def test_source_of_class_at_eof_without_newline(tmpdir): s2 = _pytest._code.Source(tmpdir.join("a.py").pyimport().A) assert str(source).strip() == str(s2).strip() + if True: def x(): pass @@ -462,6 +463,7 @@ def test_getfslineno(): assert lineno == A_lineno assert getfslineno(3) == ("", -1) + class B(object): pass B.__name__ = "B2" @@ -471,6 +473,7 @@ def test_code_of_object_instance_with_call(): class A(object): pass pytest.raises(TypeError, lambda: _pytest._code.Source(A())) + class WithCall(object): def __call__(self): pass diff --git a/testing/freeze/create_executable.py b/testing/freeze/create_executable.py index 8cf259c40..f4f6088ef 100644 --- a/testing/freeze/create_executable.py +++ b/testing/freeze/create_executable.py @@ -10,4 +10,3 @@ if __name__ == '__main__': hidden.extend(['--hidden-import', x]) args = ['pyinstaller', '--noconfirm'] + hidden + ['runtests_script.py'] subprocess.check_call(' '.join(args), shell=True) - diff --git a/testing/freeze/runtests_script.py b/testing/freeze/runtests_script.py index cb961fc6c..d281601c0 100644 --- a/testing/freeze/runtests_script.py +++ b/testing/freeze/runtests_script.py @@ -6,4 +6,4 @@ py.test main(). if __name__ == '__main__': import sys import pytest - sys.exit(pytest.main()) \ No newline at end of file + sys.exit(pytest.main()) diff --git a/testing/freeze/tests/test_trivial.py b/testing/freeze/tests/test_trivial.py index 6cf6b05ad..f0f29ee60 100644 --- a/testing/freeze/tests/test_trivial.py +++ b/testing/freeze/tests/test_trivial.py @@ -3,4 +3,4 @@ def test_upper(): assert 'foo'.upper() == 'FOO' def test_lower(): - assert 'FOO'.lower() == 'foo' \ No newline at end of file + assert 'FOO'.lower() == 'foo' diff --git a/testing/freeze/tox_run.py b/testing/freeze/tox_run.py index 5310ac1b7..3fc388040 100644 --- a/testing/freeze/tox_run.py +++ b/testing/freeze/tox_run.py @@ -9,4 +9,4 @@ if __name__ == '__main__': executable = os.path.join(os.getcwd(), 'dist', 'runtests_script', 'runtests_script') if sys.platform.startswith('win'): executable += '.exe' - sys.exit(os.system('%s tests' % executable)) \ No newline at end of file + sys.exit(os.system('%s tests' % executable)) diff --git a/testing/python/approx.py b/testing/python/approx.py index d7063e215..d9bbaa4e0 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -309,4 +309,3 @@ class TestApprox(object): '*At index 0 diff: 3 != 4 * {0}'.format(expected), '=* 1 failed in *=', ]) - diff --git a/testing/python/fixture.py b/testing/python/fixture.py index 1e58a5550..ff49346c6 100644 --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -3026,6 +3026,3 @@ class TestParameterizedSubRequest(object): E*{1}:5 *1 failed* """.format(fixfile.strpath, testfile.basename)) - - - diff --git a/testing/test_config.py b/testing/test_config.py index 0d8e6abfc..ddabf6a29 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -826,4 +826,3 @@ class TestOverrideIniArgs(object): rootdir, inifile, inicfg = determine_setup(None, ['a/exist']) assert rootdir == tmpdir assert inifile is None - diff --git a/testing/test_doctest.py b/testing/test_doctest.py index 26f9c8469..4a813e5c0 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -932,4 +932,3 @@ class TestDoctestReportingOption(object): result.stderr.fnmatch_lines([ "*error: argument --doctest-report: invalid choice: 'obviously_invalid_format' (choose from*" ]) - diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index bc637b035..af6eabf98 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -1057,4 +1057,3 @@ def test_set_suite_name(testdir, suite_name): assert result.ret == 0 node = dom.find_first_by_tag("testsuite") node.assert_attr(name=expected) - diff --git a/testing/test_pastebin.py b/testing/test_pastebin.py index 3fe66e972..f7716f8fd 100644 --- a/testing/test_pastebin.py +++ b/testing/test_pastebin.py @@ -114,5 +114,3 @@ class TestPaste(object): assert 'lexer=%s' % lexer in data.decode() assert 'code=full-paste-contents' in data.decode() assert 'expiry=1week' in data.decode() - - diff --git a/testing/test_resultlog.py b/testing/test_resultlog.py index cb083225c..fd167c36b 100644 --- a/testing/test_resultlog.py +++ b/testing/test_resultlog.py @@ -224,5 +224,3 @@ def test_failure_issue380(testdir): """) result = testdir.runpytest("--resultlog=log") assert result.ret == 2 - - diff --git a/testing/test_runner.py b/testing/test_runner.py index def80ea5f..eb7e161a3 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -754,5 +754,3 @@ class TestReportContents(object): rep = reports[1] assert rep.capstdout == '' assert rep.capstderr == '' - - diff --git a/tox.ini b/tox.ini index ac8bf13b8..100a22d45 100644 --- a/tox.ini +++ b/tox.ini @@ -196,6 +196,6 @@ filterwarnings = ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning [flake8] -ignore = E101,E111,E113,E121,E122,E123,E124,E125,E126,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,W191,W292,W293,W391 +ignore = E101,E111,E113,E121,E122,E123,E124,E125,E126,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 max-line-length = 120 exclude = _pytest/vendored_packages/pluggy.py