diff --git a/_pytest/__init__.py b/_pytest/__init__.py index 4e0bab1cd..e40bc8336 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.3.0.dev15' +__version__ = '2.3.0.dev16' diff --git a/_pytest/nose.py b/_pytest/nose.py index 5560e473d..215fac291 100644 --- a/_pytest/nose.py +++ b/_pytest/nose.py @@ -41,7 +41,7 @@ def pytest_make_collect_report(collector): def call_optional(obj, name): method = getattr(obj, name, None) - if method: + if method is not None and not hasattr(method, "_pytestsetup"): # If there's any problems allow the exception to raise rather than # silently ignoring them method() diff --git a/setup.py b/setup.py index 8f32832c0..6f050e569 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ def main(): name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.3.0.dev15', + version='2.3.0.dev16', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff --git a/testing/test_nose.py b/testing/test_nose.py index ea35c222d..9b6b53dd3 100644 --- a/testing/test_nose.py +++ b/testing/test_nose.py @@ -24,6 +24,17 @@ def test_nose_setup(testdir): ]) +def test_setup_func_with_setup_decorator(): + from _pytest.nose import call_optional + l = [] + class A: + @pytest.setup() + def f(self): + l.append(1) + call_optional(A(), "f") + assert not l + + def test_nose_setup_func(testdir): p = testdir.makepyfile(""" from nose.tools import with_setup