Merge pull request #4164 from RonnyPfannschmidt/nowarn-session-attributes
don`t parse compat properties as fixtures
This commit is contained in:
commit
0fea71a4f5
|
@ -0,0 +1 @@
|
||||||
|
Fix false ``RemovedInPytest4Warning: usage of Session... is deprecated, please use pytest`` warnings.
|
|
@ -1193,6 +1193,7 @@ class FixtureManager(object):
|
||||||
nodeid = p.dirpath().relto(self.config.rootdir)
|
nodeid = p.dirpath().relto(self.config.rootdir)
|
||||||
if p.sep != nodes.SEP:
|
if p.sep != nodes.SEP:
|
||||||
nodeid = nodeid.replace(p.sep, nodes.SEP)
|
nodeid = nodeid.replace(p.sep, nodes.SEP)
|
||||||
|
|
||||||
self.parsefactories(plugin, nodeid)
|
self.parsefactories(plugin, nodeid)
|
||||||
|
|
||||||
def _getautousenames(self, nodeid):
|
def _getautousenames(self, nodeid):
|
||||||
|
@ -1297,11 +1298,18 @@ class FixtureManager(object):
|
||||||
nodeid = node_or_obj.nodeid
|
nodeid = node_or_obj.nodeid
|
||||||
if holderobj in self._holderobjseen:
|
if holderobj in self._holderobjseen:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
from _pytest.nodes import _CompatProperty
|
||||||
|
|
||||||
self._holderobjseen.add(holderobj)
|
self._holderobjseen.add(holderobj)
|
||||||
autousenames = []
|
autousenames = []
|
||||||
for name in dir(holderobj):
|
for name in dir(holderobj):
|
||||||
# The attribute can be an arbitrary descriptor, so the attribute
|
# The attribute can be an arbitrary descriptor, so the attribute
|
||||||
# access below can raise. safe_getatt() ignores such exceptions.
|
# 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)
|
obj = safe_getattr(holderobj, name, None)
|
||||||
marker = getfixturemarker(obj)
|
marker = getfixturemarker(obj)
|
||||||
# fixture functions have a pytest_funcarg__ prefix (pre-2.3 style)
|
# fixture functions have a pytest_funcarg__ prefix (pre-2.3 style)
|
||||||
|
|
Loading…
Reference in New Issue