Add missing __test__ check for test discovery.

This commit is contained in:
Luke Murphy
2016-11-30 12:17:51 +01:00
parent 36eb5b36d1
commit f5afd8cb54
4 changed files with 25 additions and 1 deletions

View File

@@ -503,6 +503,8 @@ def _get_xunit_func(obj, name):
class Class(PyCollector):
""" Collector for test methods. """
def collect(self):
if not safe_getattr(self.obj, "__test__", True):
return []
if hasinit(self.obj):
self.warn("C1", "cannot collect test class %r because it has a "
"__init__ constructor" % self.obj.__name__)