From da04ff52e4bfeeb604f52b44d9031b3dc74c7004 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Fri, 5 Oct 2018 11:51:36 +0200 Subject: [PATCH 1/2] ignore _CompatProperty when parsing fixtures this avoid triggering the warnings when parsing the session node as session plugin --- changelog/2701.bugfix.rst | 1 + src/_pytest/fixtures.py | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 changelog/2701.bugfix.rst diff --git a/changelog/2701.bugfix.rst b/changelog/2701.bugfix.rst new file mode 100644 index 000000000..af16a08ad --- /dev/null +++ b/changelog/2701.bugfix.rst @@ -0,0 +1 @@ +avoid "RemovedInPytest4Warning: usage of Session... is deprecated, please use pytest... instead" warnings.:w diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 49c3402dc..26a28ca80 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -1193,6 +1193,7 @@ class FixtureManager(object): nodeid = p.dirpath().relto(self.config.rootdir) if p.sep != nodes.SEP: nodeid = nodeid.replace(p.sep, nodes.SEP) + self.parsefactories(plugin, nodeid) def _getautousenames(self, nodeid): @@ -1297,11 +1298,18 @@ class FixtureManager(object): nodeid = node_or_obj.nodeid if holderobj in self._holderobjseen: return + + from _pytest.nodes import _CompatProperty + self._holderobjseen.add(holderobj) autousenames = [] for name in dir(holderobj): # The attribute can be an arbitrary descriptor, so the attribute # access below can raise. safe_getatt() ignores such exceptions. + maybe_property = safe_getattr(type(holderobj), name, None) + if isinstance(maybe_property, _CompatProperty): + # deprecated + continue obj = safe_getattr(holderobj, name, None) marker = getfixturemarker(obj) # fixture functions have a pytest_funcarg__ prefix (pre-2.3 style) From b5d62cdb553484267a005707c94faf0287433f5e Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 31 Oct 2018 11:07:24 -0300 Subject: [PATCH 2/2] Update 2701.bugfix.rst --- changelog/2701.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/2701.bugfix.rst b/changelog/2701.bugfix.rst index af16a08ad..a942234fd 100644 --- a/changelog/2701.bugfix.rst +++ b/changelog/2701.bugfix.rst @@ -1 +1 @@ -avoid "RemovedInPytest4Warning: usage of Session... is deprecated, please use pytest... instead" warnings.:w +Fix false ``RemovedInPytest4Warning: usage of Session... is deprecated, please use pytest`` warnings.