Mapping exceptions to test outcomes

Map exceptions to test outcomes.

This plugin implements setTestOutcome() to enable simple mapping of exception classes to existing test outcomes.

By setting a list of exception classes in a nose2 config file, you can configure exceptions that would otherwise be treated as test errors, to be treated as failures or skips instead:

[outcomes]
always-on = True
treat-as-fail = NotImplementedError
treat-as-skip = TodoError
                IOError

Configuration [outcomes]

always-on
Default :False
Type :boolean
treat-as-fail
Default :[]
Type :list
treat-as-skip
Default :[]
Type :list

Sample configuration

The default configuration is equivalent to including the following in a unittest.cfg file.

[outcomes]
always-on = False
treat-as-fail = 
treat-as-skip = 

Command-line options

--set-outcomes DEFAULT

Treat some configured exceptions as failure or skips

Plugin class reference: Outcomes

class nose2.plugins.outcomes.Outcomes[source]

Map exceptions to other test outcomes

setTestOutcome(event)[source]

Update outcome, exc_info and reason based on configured mappings