Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/2701.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix false ``RemovedInPytest4Warning: usage of Session... is deprecated, please use pytest`` warnings.
8 changes: 8 additions & 0 deletions src/_pytest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,7 @@ def pytest_plugin_registered(self, plugin):
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):
Expand Down Expand Up @@ -1297,11 +1298,18 @@ def parsefactories(self, node_or_obj, nodeid=NOTSET, unittest=False):
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)
Expand Down