merge pull request
This commit is contained in:
commit
df444906d6
|
@ -41,7 +41,7 @@ def pytest_make_collect_report(collector):
|
||||||
|
|
||||||
def call_optional(obj, name):
|
def call_optional(obj, name):
|
||||||
method = getattr(obj, name, None)
|
method = getattr(obj, name, None)
|
||||||
if method is not None and not hasattr(method, "_pytestfixturefunction"):
|
if method is not None and not hasattr(method, "_pytestfixturefunction") and callable(method):
|
||||||
# If there's any problems allow the exception to raise rather than
|
# If there's any problems allow the exception to raise rather than
|
||||||
# silently ignoring them
|
# silently ignoring them
|
||||||
method()
|
method()
|
||||||
|
|
|
@ -35,6 +35,12 @@ def test_setup_func_with_setup_decorator():
|
||||||
assert not l
|
assert not l
|
||||||
|
|
||||||
|
|
||||||
|
def test_setup_func_not_callable():
|
||||||
|
from _pytest.nose import call_optional
|
||||||
|
class A:
|
||||||
|
f = 1
|
||||||
|
call_optional(A(), "f")
|
||||||
|
|
||||||
def test_nose_setup_func(testdir):
|
def test_nose_setup_func(testdir):
|
||||||
p = testdir.makepyfile("""
|
p = testdir.makepyfile("""
|
||||||
from nose.tools import with_setup
|
from nose.tools import with_setup
|
||||||
|
|
Loading…
Reference in New Issue