From 1f6dc215338747f596f6df664ef2f7cd500c658f Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 12 Sep 2017 18:15:47 -0300 Subject: [PATCH] Turned warnings into errors - Fix two correct warnings - Used pytest.warns() around a valid warning being issued Should remove the warning exception for #81 when we tackle that. Fix #78 --- pluggy/__init__.py | 3 ++- testing/test_method_ordering.py | 4 ++-- testing/test_pluginmanager.py | 3 ++- tox.ini | 4 ++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pluggy/__init__.py b/pluggy/__init__.py index 863b04d3..eb4cdd30 100644 --- a/pluggy/__init__.py +++ b/pluggy/__init__.py @@ -675,7 +675,8 @@ def __call__(self, *args, **kwargs): warnings.warn( "Argument(s) {0} which are declared in the hookspec " "can not be found in this hook call" - .format(tuple(notincall)) + .format(tuple(notincall)), + stacklevel=2, ) return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) diff --git a/testing/test_method_ordering.py b/testing/test_method_ordering.py index 562fa706..8c3121dc 100644 --- a/testing/test_method_ordering.py +++ b/testing/test_method_ordering.py @@ -238,7 +238,7 @@ def after(outcome, hook_name, hook_impls, kwargs): undo = he_pm.add_hookcall_monitoring(before, after) - he_pm.hook.he_method1() + he_pm.hook.he_method1(arg=1) assert len(l) == 4 assert l[0][0] == "he_method1" assert len(l[0][1]) == 2 @@ -249,7 +249,7 @@ def after(outcome, hook_name, hook_impls, kwargs): assert l[3][1] == l[0][0] undo() - he_pm.hook.he_method1() + he_pm.hook.he_method1(arg=1) assert len(l) == 4 + 2 diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py index 922fc078..7e9701b3 100644 --- a/testing/test_pluginmanager.py +++ b/testing/test_pluginmanager.py @@ -284,7 +284,8 @@ def he_method1(self, arg): 0 / 0 pm.register(Plugin1()) with pytest.raises(HookCallError): - pm.hook.he_method1() + with pytest.warns(UserWarning): + pm.hook.he_method1() def test_subset_hook_caller(pm): diff --git a/tox.ini b/tox.ini index 57a1c5a7..2acf6835 100644 --- a/tox.ini +++ b/tox.ini @@ -37,6 +37,10 @@ minversion=2.0 #--pyargs --doctest-modules --ignore=.tox addopts=-rxsX norecursedirs=.tox ja .hg .env* +filterwarnings = + error + # inspect.getargspec() ignored, should be fixed in #81 + ignore:inspect.getargspec().*deprecated [flake8] max-line-length=99