From 49ec2aed0f326fc5fa25dbdd7c47bf0a888dbd97 Mon Sep 17 00:00:00 2001 From: Gleb Nikonorov Date: Sun, 28 Jun 2020 10:48:33 -0400 Subject: [PATCH] change stacklevel in warnings from 2 to 3 --- src/_pytest/config/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 9ed372959..b5cff7301 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -1186,7 +1186,7 @@ class Config: from _pytest.warnings import _issue_warning_captured _issue_warning_captured( - PytestConfigWarning(message), self.hook, stacklevel=2, + PytestConfigWarning(message), self.hook, stacklevel=3, ) def _get_unknown_ini_keys(self) -> List[str]: @@ -1375,7 +1375,7 @@ class Config: "(are you using python -O?)\n" ) _issue_warning_captured( - PytestConfigWarning(warning_text), self.hook, stacklevel=2, + PytestConfigWarning(warning_text), self.hook, stacklevel=3, )