Show test module in the PytestCollectionWarning message

Related to #5330
This commit is contained in:
Bruno Oliveira
2019-05-30 08:18:28 -03:00
parent 72fc43952b
commit 5cbc06a453
3 changed files with 24 additions and 3 deletions

View File

@@ -720,7 +720,8 @@ class Class(PyCollector):
self.warn(
PytestCollectionWarning(
"cannot collect test class %r because it has a "
"__init__ constructor" % self.obj.__name__
"__init__ constructor (from: %s)"
% (self.obj.__name__, self.parent.nodeid)
)
)
return []
@@ -728,7 +729,8 @@ class Class(PyCollector):
self.warn(
PytestCollectionWarning(
"cannot collect test class %r because it has a "
"__new__ constructor" % self.obj.__name__
"__new__ constructor (from: %s)"
% (self.obj.__name__, self.parent.nodeid)
)
)
return []