From 39331856edb7bf54b8fbac0757501a85dba37993 Mon Sep 17 00:00:00 2001 From: Andreas Pelme Date: Sun, 13 Aug 2017 14:56:30 +0200 Subject: [PATCH] Use the correct stacklevel for getfuncargvalue() deprecation warning. Fixed #2681. --- _pytest/fixtures.py | 3 ++- changelog/2681.bugfix | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog/2681.bugfix diff --git a/_pytest/fixtures.py b/_pytest/fixtures.py index b588c312a..4386500f4 100644 --- a/_pytest/fixtures.py +++ b/_pytest/fixtures.py @@ -432,7 +432,8 @@ class FixtureRequest(FuncargnamesCompatAttr): from _pytest import deprecated warnings.warn( deprecated.GETFUNCARGVALUE, - DeprecationWarning) + DeprecationWarning, + stacklevel=2) return self.getfixturevalue(argname) def _get_active_fixturedef(self, argname): diff --git a/changelog/2681.bugfix b/changelog/2681.bugfix new file mode 100644 index 000000000..a29c31fb7 --- /dev/null +++ b/changelog/2681.bugfix @@ -0,0 +1 @@ +Calling the deprecated `request.getfuncargvalue()` now shows the source of the call.