From 7d17957e90d94f25d90addf814bb02749b9dd917 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 11 Oct 2015 12:34:47 +0200 Subject: [PATCH] Ignore inspect.getargspec() warning during tests. https://github.com/pytest-dev/pytest-bdd/issues/153 --- tests/conftest.py | 4 ++++ tests/test_conftest.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 08e600b2a..6ca235383 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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() diff --git a/tests/test_conftest.py b/tests/test_conftest.py index 0af725f30..4984b7efe 100644 --- a/tests/test_conftest.py +++ b/tests/test_conftest.py @@ -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)