Skip to content

Commit b55f5eb

Browse files
ignore _CompatProperty when parsing fixtures
this avoid triggering the warnings when parsing the session node as session plugin
1 parent e6e40db commit b55f5eb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/_pytest/fixtures.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,7 @@ def pytest_plugin_registered(self, plugin):
11931193
nodeid = p.dirpath().relto(self.config.rootdir)
11941194
if p.sep != nodes.SEP:
11951195
nodeid = nodeid.replace(p.sep, nodes.SEP)
1196+
11961197
self.parsefactories(plugin, nodeid)
11971198

11981199
def _getautousenames(self, nodeid):
@@ -1297,11 +1298,18 @@ def parsefactories(self, node_or_obj, nodeid=NOTSET, unittest=False):
12971298
nodeid = node_or_obj.nodeid
12981299
if holderobj in self._holderobjseen:
12991300
return
1301+
1302+
from _pytest.nodes import _CompatProperty
1303+
13001304
self._holderobjseen.add(holderobj)
13011305
autousenames = []
13021306
for name in dir(holderobj):
13031307
# The attribute can be an arbitrary descriptor, so the attribute
13041308
# access below can raise. safe_getatt() ignores such exceptions.
1309+
maybe_property = safe_getattr(type(holderobj), name, None)
1310+
if isinstance(maybe_property, _CompatProperty):
1311+
# deprecated
1312+
continue
13051313
obj = safe_getattr(holderobj, name, None)
13061314
marker = getfixturemarker(obj)
13071315
# fixture functions have a pytest_funcarg__ prefix (pre-2.3 style)

0 commit comments

Comments
 (0)