Plugin that installs a KNOWNFAIL error class for the KnownFailureClass exception. When KnownFailureTest is raised, the exception will be logged in the knownfail attribute of the result, 'K' or 'KNOWNFAIL' (verbose) will be output, and the exception will not be counted as an error or
| 13 | |
| 14 | |
| 15 | class KnownFailure(ErrorClassPlugin): |
| 16 | '''Plugin that installs a KNOWNFAIL error class for the |
| 17 | KnownFailureClass exception. When KnownFailureTest is raised, |
| 18 | the exception will be logged in the knownfail attribute of the |
| 19 | result, 'K' or 'KNOWNFAIL' (verbose) will be output, and the |
| 20 | exception will not be counted as an error or failure.''' |
| 21 | enabled = True |
| 22 | knownfail = ErrorClass(KnownFailureTest, |
| 23 | label='KNOWNFAIL', |
| 24 | isfailure=False) |
| 25 | |
| 26 | def options(self, parser, env=os.environ): |
| 27 | env_opt = 'NOSE_WITHOUT_KNOWNFAIL' |
| 28 | parser.add_option('--no-knownfail', action='store_true', |
| 29 | dest='noKnownFail', default=env.get(env_opt, False), |
| 30 | help='Disable special handling of KnownFailureTest ' |
| 31 | 'exceptions') |
| 32 | |
| 33 | def configure(self, options, conf): |
| 34 | if not self.can_configure: |
| 35 | return |
| 36 | self.conf = conf |
| 37 | disable = getattr(options, 'noKnownFail', False) |
| 38 | if disable: |
| 39 | self.enabled = False |
| 40 | |
| 41 |