Fix flake8 E305 and E306 errors

These errors started to appear with flake8-3.1.1, while they don't appear with
version 3.1.0 (weird).
This commit is contained in:
Bruno Oliveira
2016-11-20 18:59:15 -02:00
parent cbf261c74e
commit 1eb5a690d4
39 changed files with 303 additions and 4 deletions

View File

@@ -20,8 +20,10 @@ class TestMetafunc:
# initiliazation
class FixtureInfo:
name2fixturedefs = None
def __init__(self, names):
self.names_closure = names
names = fixtures.getfuncargnames(func)
fixtureinfo = FixtureInfo(names)
return python.Metafunc(func, fixtureinfo, None)
@@ -65,7 +67,9 @@ class TestMetafunc:
def test_addcall_param(self):
def func(arg1): pass
metafunc = self.Metafunc(func)
class obj: pass
metafunc.addcall(param=obj)
metafunc.addcall(param=obj)
metafunc.addcall(param=1)
@@ -76,8 +80,11 @@ class TestMetafunc:
def test_addcall_funcargs(self):
def func(x): pass
metafunc = self.Metafunc(func)
class obj: pass
metafunc.addcall(funcargs={"x": 2})
metafunc.addcall(funcargs={"x": 3})
pytest.raises(pytest.fail.Exception, "metafunc.addcall({'xyz': 0})")
@@ -142,8 +149,10 @@ class TestMetafunc:
def test_parametrize_with_userobjects(self):
def func(x, y): pass
metafunc = self.Metafunc(func)
class A:
pass
metafunc.parametrize("x", [A(), A()])
metafunc.parametrize("y", list("ab"))
assert metafunc._calls[0].id == "x0-a"
@@ -254,6 +263,7 @@ class TestMetafunc:
@pytest.mark.issue351
def test_idmaker_idfn(self):
from _pytest.python import idmaker
def ids(val):
if isinstance(val, Exception):
return repr(val)
@@ -270,6 +280,7 @@ class TestMetafunc:
@pytest.mark.issue351
def test_idmaker_idfn_unique_names(self):
from _pytest.python import idmaker
def ids(val):
return 'a'
@@ -285,6 +296,7 @@ class TestMetafunc:
@pytest.mark.issue351
def test_idmaker_idfn_exception(self):
from _pytest.python import idmaker
def ids(val):
raise Exception("bad code")