Fixed E701 flake8 errors
multiple statements on one line (colon)
This commit is contained in:
parent
7d2ceb7872
commit
85141a419f
|
@ -149,8 +149,10 @@ class TestExceptionInfo(object):
|
||||||
|
|
||||||
def test_bad_getsource(self):
|
def test_bad_getsource(self):
|
||||||
try:
|
try:
|
||||||
if False: pass
|
if False:
|
||||||
else: assert False
|
pass
|
||||||
|
else:
|
||||||
|
assert False
|
||||||
except AssertionError:
|
except AssertionError:
|
||||||
exci = _pytest._code.ExceptionInfo()
|
exci = _pytest._code.ExceptionInfo()
|
||||||
assert exci.getrepr()
|
assert exci.getrepr()
|
||||||
|
@ -160,11 +162,13 @@ class TestTracebackEntry(object):
|
||||||
|
|
||||||
def test_getsource(self):
|
def test_getsource(self):
|
||||||
try:
|
try:
|
||||||
if False: pass
|
if False:
|
||||||
else: assert False
|
pass
|
||||||
|
else:
|
||||||
|
assert False
|
||||||
except AssertionError:
|
except AssertionError:
|
||||||
exci = _pytest._code.ExceptionInfo()
|
exci = _pytest._code.ExceptionInfo()
|
||||||
entry = exci.traceback[0]
|
entry = exci.traceback[0]
|
||||||
source = entry.getsource()
|
source = entry.getsource()
|
||||||
assert len(source) == 4
|
assert len(source) == 6
|
||||||
assert 'else: assert False' in source[3]
|
assert 'assert False' in source[5]
|
||||||
|
|
|
@ -991,7 +991,8 @@ raise ValueError()
|
||||||
r = excinfo.getrepr(style="long")
|
r = excinfo.getrepr(style="long")
|
||||||
tw = TWMock()
|
tw = TWMock()
|
||||||
r.toterminal(tw)
|
r.toterminal(tw)
|
||||||
for line in tw.lines: print (line)
|
for line in tw.lines:
|
||||||
|
print (line)
|
||||||
assert tw.lines[0] == ""
|
assert tw.lines[0] == ""
|
||||||
assert tw.lines[1] == " def f():"
|
assert tw.lines[1] == " def f():"
|
||||||
assert tw.lines[2] == "> g()"
|
assert tw.lines[2] == "> g()"
|
||||||
|
@ -1038,7 +1039,8 @@ raise ValueError()
|
||||||
r = excinfo.getrepr(style="long")
|
r = excinfo.getrepr(style="long")
|
||||||
tw = TWMock()
|
tw = TWMock()
|
||||||
r.toterminal(tw)
|
r.toterminal(tw)
|
||||||
for line in tw.lines: print (line)
|
for line in tw.lines:
|
||||||
|
print (line)
|
||||||
assert tw.lines[0] == ""
|
assert tw.lines[0] == ""
|
||||||
assert tw.lines[1] == " def f():"
|
assert tw.lines[1] == " def f():"
|
||||||
assert tw.lines[2] == " try:"
|
assert tw.lines[2] == " try:"
|
||||||
|
|
|
@ -68,7 +68,8 @@ class TestMetafunc(object):
|
||||||
def func(arg1): pass
|
def func(arg1): pass
|
||||||
metafunc = self.Metafunc(func)
|
metafunc = self.Metafunc(func)
|
||||||
|
|
||||||
class obj(object): pass
|
class obj(object):
|
||||||
|
pass
|
||||||
|
|
||||||
metafunc.addcall(param=obj)
|
metafunc.addcall(param=obj)
|
||||||
metafunc.addcall(param=obj)
|
metafunc.addcall(param=obj)
|
||||||
|
@ -83,7 +84,8 @@ class TestMetafunc(object):
|
||||||
|
|
||||||
metafunc = self.Metafunc(func)
|
metafunc = self.Metafunc(func)
|
||||||
|
|
||||||
class obj(object): pass
|
class obj(object):
|
||||||
|
pass
|
||||||
|
|
||||||
metafunc.addcall(funcargs={"x": 2})
|
metafunc.addcall(funcargs={"x": 2})
|
||||||
metafunc.addcall(funcargs={"x": 3})
|
metafunc.addcall(funcargs={"x": 3})
|
||||||
|
|
|
@ -283,9 +283,11 @@ class TestWarns(object):
|
||||||
assert str(record[0].message) == "user"
|
assert str(record[0].message) == "user"
|
||||||
assert str(record[1].message) == "runtime"
|
assert str(record[1].message) == "runtime"
|
||||||
|
|
||||||
class MyUserWarning(UserWarning): pass
|
class MyUserWarning(UserWarning):
|
||||||
|
pass
|
||||||
|
|
||||||
class MyRuntimeWarning(RuntimeWarning): pass
|
class MyRuntimeWarning(RuntimeWarning):
|
||||||
|
pass
|
||||||
|
|
||||||
with pytest.warns((UserWarning, RuntimeWarning)) as record:
|
with pytest.warns((UserWarning, RuntimeWarning)) as record:
|
||||||
warnings.warn("user", MyUserWarning)
|
warnings.warn("user", MyUserWarning)
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -196,6 +196,6 @@ filterwarnings =
|
||||||
ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning
|
ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
ignore = E701,E702,E704,E712,E731
|
ignore = E702,E704,E712,E731
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
exclude = _pytest/vendored_packages/pluggy.py
|
exclude = _pytest/vendored_packages/pluggy.py
|
||||||
|
|
Loading…
Reference in New Issue