Skip to content

Commit

Permalink
Merge pull request #89 from nicoddemus/warnings-into-errors
Browse files Browse the repository at this point in the history
Turned warnings into errors
  • Loading branch information
RonnyPfannschmidt committed Sep 13, 2017
2 parents 1037dc9 + 1f6dc21 commit 6f28308
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pluggy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions testing/test_method_ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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


Expand Down
3 changes: 2 additions & 1 deletion testing/test_pluginmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6f28308

Please sign in to comment.