SkipTest result capture

6 views
Skip to first unread message

richard

unread,
Jan 11, 2008, 7:27:11 AM1/11/08
to nose-users
I have a custom logger and a corresponding plug-in that reports 'PASS'
via addSuccess() for example instead of the default output. I would
like to log skipped tests also; I know that there is a 'skipped'
attribute attached to the result object but I can't see a way of
accessing that via the plug-in hooks supplied - as most refer to the
Test instance rather than the 'result' one.

Is there a way of doing this?


Thanks ...

Richard

John J Lee

unread,
Jan 11, 2008, 2:47:17 PM1/11/08
to nose-users
On Fri, 11 Jan 2008, richard wrote:

> I have a custom logger and a corresponding plug-in that reports 'PASS'
> via addSuccess() for example instead of the default output. I would
> like to log skipped tests also; I know that there is a 'skipped'
> attribute attached to the result object but I can't see a way of
> accessing that via the plug-in hooks supplied - as most refer to the
> Test instance rather than the 'result' one.

import nose.plugins.skip

...

def addError(self, test, err):
if issubclass(err[0], nose.plugins.skip.SkipTest):
log_skip(test, err)


If you want to log all error classes, not just errors, failures, and
skips, you can fish them out of the overall result of the test run (which
you can store on your plugin instance, by implementing
.prepareTestResult()). So you'd loop through result.errorClasses.items(),
much as nose.result._TextTestResult.addError() does.


John

Reply all
Reply to author
Forward
0 new messages