Ignore inspect.getargspec() warning during tests.

https://github.com/pytest-dev/pytest-bdd/issues/153
This commit is contained in:
Florian Bruhin 2015-10-11 12:34:47 +02:00
parent 670a4d274b
commit 7d17957e90
2 changed files with 10 additions and 0 deletions

View File

@ -335,6 +335,10 @@ def py_proc():
@pytest.yield_fixture(autouse=True)
def fail_tests_on_warnings():
warnings.simplefilter('error')
# https://github.com/pytest-dev/pytest-bdd/issues/153
warnings.filterwarnings('ignore', message=r'inspect.getargspec\(\) is '
r'deprecated, use inspect.signature\(\) instead',
category=DeprecationWarning)
yield
warnings.resetwarnings()

View File

@ -21,6 +21,7 @@
import warnings
import inspect
import pytest
@ -38,3 +39,8 @@ def test_no_qapp(request):
def test_fail_on_warnings():
with pytest.raises(PendingDeprecationWarning):
warnings.warn('test', PendingDeprecationWarning)
def test_getargspec():
"""Make sure the getargspec DeprecationWarning gets ignored."""
inspect.getargspec(lambda: None)