Deprecate custom node types during collection by using special names

This commit is contained in:
Bruno Oliveira
2018-09-13 14:55:28 -03:00
parent 482bd5efd2
commit b7dd9154c3
3 changed files with 44 additions and 4 deletions

View File

@@ -130,10 +130,13 @@ class Node(object):
return getattr(__import__("pytest"), name)
else:
cls = getattr(self, name)
# TODO: reenable in the features branch
# warnings.warn("use of node.%s is deprecated, "
# "use pytest_pycollect_makeitem(...) to create custom "
# "collection nodes" % name, category=DeprecationWarning)
msg = (
'use of special named "%s" objects in collectors of type "%s" to '
"customize the created nodes is deprecated. "
"Use pytest_pycollect_makeitem(...) to create custom "
"collection nodes instead." % (name, type(self).__name__)
)
self.warn(RemovedInPytest4Warning(msg))
return cls
def __repr__(self):