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

@@ -10,15 +10,20 @@ from _pytest import fixtures
def test_getfuncargnames():
def f(): pass
assert not fixtures.getfuncargnames(f)
def g(arg): pass
assert fixtures.getfuncargnames(g) == ('arg',)
def h(arg1, arg2="hello"): pass
assert fixtures.getfuncargnames(h) == ('arg1',)
def h(arg1, arg2, arg3="hello"): pass
assert fixtures.getfuncargnames(h) == ('arg1', 'arg2')
class A:
def f(self, arg1, arg2="hello"):
pass
assert fixtures.getfuncargnames(A().f) == ('arg1',)
if sys.version_info < (3,0):
assert fixtures.getfuncargnames(A.f) == ('arg1',)
@@ -869,8 +874,10 @@ class TestRequestCachedSetup:
item1 = testdir.getitem("def test_func(): pass")
req1 = fixtures.FixtureRequest(item1)
l = ["hello", "world"]
def setup():
return l.pop()
ret1 = req1.cached_setup(setup, extrakey=1)
ret2 = req1.cached_setup(setup, extrakey=2)
assert ret2 == "hello"
@@ -884,10 +891,13 @@ class TestRequestCachedSetup:
item1 = testdir.getitem("def test_func(): pass")
req1 = fixtures.FixtureRequest(item1)
l = []
def setup():
l.append("setup")
def teardown(val):
l.append("teardown")
req1.cached_setup(setup, teardown, scope="function")
assert l == ['setup']
# artificial call of finalizer