introduce an option that avoids discovery of classes other than unittest.TestCase in modules
importing unittest.
This commit is contained in:
@@ -59,6 +59,8 @@ def pytest_pycollect_makeitem(__multicall__, collector, name, obj):
|
||||
if res is not None:
|
||||
return res
|
||||
if collector._istestclasscandidate(name, obj):
|
||||
if hasattr(collector.obj, 'unittest'):
|
||||
return # we assume it's a mixin class for a TestCase derived one
|
||||
return Class(name, parent=collector)
|
||||
elif collector.funcnamefilter(name) and hasattr(obj, '__call__'):
|
||||
if is_generator(obj):
|
||||
@@ -124,6 +126,7 @@ class PyobjMixin(object):
|
||||
return self._fslineno
|
||||
|
||||
def reportinfo(self):
|
||||
# XXX caching?
|
||||
obj = self.obj
|
||||
if hasattr(obj, 'compat_co_firstlineno'):
|
||||
# nose compatibility
|
||||
|
||||
Reference in New Issue
Block a user