Fixed E302 flake8 errors
expected 2 blank lines, found 0
This commit is contained in:
@@ -27,6 +27,7 @@ else:
|
||||
import pytest
|
||||
pytest_version_info = tuple(map(int, pytest.__version__.split(".")[:3]))
|
||||
|
||||
|
||||
class TWMock(object):
|
||||
WRITE = object()
|
||||
|
||||
@@ -53,6 +54,7 @@ class TWMock(object):
|
||||
|
||||
fullwidth = 80
|
||||
|
||||
|
||||
def test_excinfo_simple():
|
||||
try:
|
||||
raise ValueError
|
||||
@@ -60,6 +62,7 @@ def test_excinfo_simple():
|
||||
info = _pytest._code.ExceptionInfo()
|
||||
assert info.type == ValueError
|
||||
|
||||
|
||||
def test_excinfo_getstatement():
|
||||
def g():
|
||||
raise ValueError
|
||||
@@ -82,20 +85,27 @@ def test_excinfo_getstatement():
|
||||
# xxx
|
||||
|
||||
# testchain for getentries test below
|
||||
|
||||
|
||||
def f():
|
||||
#
|
||||
raise ValueError
|
||||
#
|
||||
|
||||
|
||||
def g():
|
||||
#
|
||||
__tracebackhide__ = True
|
||||
f()
|
||||
#
|
||||
|
||||
|
||||
def h():
|
||||
#
|
||||
g()
|
||||
#
|
||||
|
||||
|
||||
class TestTraceback_f_g_h(object):
|
||||
def setup_method(self, method):
|
||||
try:
|
||||
@@ -299,6 +309,7 @@ class TestTraceback_f_g_h(object):
|
||||
assert entry.lineno == co.firstlineno + 2
|
||||
assert entry.frame.code.name == 'g'
|
||||
|
||||
|
||||
def test_excinfo_exconly():
|
||||
excinfo = pytest.raises(ValueError, h)
|
||||
assert excinfo.exconly().startswith('ValueError')
|
||||
@@ -308,11 +319,13 @@ def test_excinfo_exconly():
|
||||
assert msg.startswith('ValueError')
|
||||
assert msg.endswith("world")
|
||||
|
||||
|
||||
def test_excinfo_repr():
|
||||
excinfo = pytest.raises(ValueError, h)
|
||||
s = repr(excinfo)
|
||||
assert s == "<ExceptionInfo ValueError tblen=4>"
|
||||
|
||||
|
||||
def test_excinfo_str():
|
||||
excinfo = pytest.raises(ValueError, h)
|
||||
s = str(excinfo)
|
||||
@@ -320,10 +333,12 @@ def test_excinfo_str():
|
||||
assert s.endswith("ValueError")
|
||||
assert len(s.split(":")) >= 3 # on windows it's 4
|
||||
|
||||
|
||||
def test_excinfo_errisinstance():
|
||||
excinfo = pytest.raises(ValueError, h)
|
||||
assert excinfo.errisinstance(ValueError)
|
||||
|
||||
|
||||
def test_excinfo_no_sourcecode():
|
||||
try:
|
||||
exec ("raise ValueError()")
|
||||
@@ -335,6 +350,7 @@ def test_excinfo_no_sourcecode():
|
||||
else:
|
||||
assert s == " File '<string>':1 in <module>\n ???\n"
|
||||
|
||||
|
||||
def test_excinfo_no_python_sourcecode(tmpdir):
|
||||
# XXX: simplified locally testable version
|
||||
tmpdir.join('test.txt').write("{{ h()}}:")
|
||||
@@ -363,6 +379,7 @@ def test_entrysource_Queue_example():
|
||||
s = str(source).strip()
|
||||
assert s.startswith("def get")
|
||||
|
||||
|
||||
def test_codepath_Queue_example():
|
||||
try:
|
||||
queue.Queue().get(timeout=0.001)
|
||||
@@ -374,11 +391,13 @@ def test_codepath_Queue_example():
|
||||
assert path.basename.lower() == "queue.py"
|
||||
assert path.check()
|
||||
|
||||
|
||||
def test_match_succeeds():
|
||||
with pytest.raises(ZeroDivisionError) as excinfo:
|
||||
0 // 0
|
||||
excinfo.match(r'.*zero.*')
|
||||
|
||||
|
||||
def test_match_raises_error(testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
@@ -393,6 +412,7 @@ def test_match_raises_error(testdir):
|
||||
"*AssertionError*Pattern*[123]*not found*",
|
||||
])
|
||||
|
||||
|
||||
class TestFormattedExcinfo(object):
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in New Issue
Block a user