Skip to content

Commit f37a5a9

Browse files
an-kyphilpep
authored andcommitted
flake8: add explicit stacklevel to warn() calls
1 parent ebe8eef commit f37a5a9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

testinfra/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616

1717

1818
def main():
19-
warnings.warn("calling testinfra is deprecated, call py.test instead")
19+
warnings.warn("calling testinfra is deprecated, call py.test instead", stacklevel=1)
2020
return pytest.main()

testinfra/modules/pip.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ def _deprecated():
147147
"""Raise a `DeprecationWarning`"""
148148
warnings.warn(
149149
"Calling host.pip_package is deprecated, call host.pip instead",
150-
DeprecationWarning,
150+
category=DeprecationWarning,
151+
stacklevel=2,
151152
)
152153

153154
@classmethod

0 commit comments

Comments
 (0)