Skip to content

Commit 6f28308

Browse files
Merge pull request #89 from nicoddemus/warnings-into-errors
Turned warnings into errors
2 parents 1037dc9 + 1f6dc21 commit 6f28308

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

pluggy/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,8 @@ def __call__(self, *args, **kwargs):
675675
warnings.warn(
676676
"Argument(s) {0} which are declared in the hookspec "
677677
"can not be found in this hook call"
678-
.format(tuple(notincall))
678+
.format(tuple(notincall)),
679+
stacklevel=2,
679680
)
680681
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
681682

testing/test_method_ordering.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def after(outcome, hook_name, hook_impls, kwargs):
238238

239239
undo = he_pm.add_hookcall_monitoring(before, after)
240240

241-
he_pm.hook.he_method1()
241+
he_pm.hook.he_method1(arg=1)
242242
assert len(l) == 4
243243
assert l[0][0] == "he_method1"
244244
assert len(l[0][1]) == 2
@@ -249,7 +249,7 @@ def after(outcome, hook_name, hook_impls, kwargs):
249249
assert l[3][1] == l[0][0]
250250

251251
undo()
252-
he_pm.hook.he_method1()
252+
he_pm.hook.he_method1(arg=1)
253253
assert len(l) == 4 + 2
254254

255255

testing/test_pluginmanager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ def he_method1(self, arg):
284284
0 / 0
285285
pm.register(Plugin1())
286286
with pytest.raises(HookCallError):
287-
pm.hook.he_method1()
287+
with pytest.warns(UserWarning):
288+
pm.hook.he_method1()
288289

289290

290291
def test_subset_hook_caller(pm):

tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ minversion=2.0
3737
#--pyargs --doctest-modules --ignore=.tox
3838
addopts=-rxsX
3939
norecursedirs=.tox ja .hg .env*
40+
filterwarnings =
41+
error
42+
# inspect.getargspec() ignored, should be fixed in #81
43+
ignore:inspect.getargspec().*deprecated
4044

4145
[flake8]
4246
max-line-length=99

0 commit comments

Comments
 (0)