##// END OF EJS Templates
Merge pull request #1535 from doerwalter/master...
Merge pull request #1535 from doerwalter/master Fix pretty printing dispatch. This patch fixes a problem mentioned here: http://mail.scipy.org/pipermail/ipython-dev/2012-March/008874.html Search for the best method to use for pretty printing an object now no longer prefers any registered printer in `type_printers` for the class or any of the base classes over a `_repr_pretty_` method defined in the class or any of its base classes. Instead the mro is walked, looking for both registered printers and `_repr_pretty_` methods, so that the inheritance hierarchy will be taken into account.

File last commit:

r3511:b64f7540
r6483:81039be0 merge
Show More
_numpy_testing_noseclasses.py
41 lines | 1.4 KiB | text/x-python | PythonLexer
/ IPython / external / decorators / _numpy_testing_noseclasses.py
Paul Ivanov
make know failures report as 'K'...
r3511 # IPython: modified copy of numpy.testing.noseclasses, so
# IPython.external._decorators works without numpy being installed.
# These classes implement a "known failure" error class.
import os
from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin
class KnownFailureTest(Exception):
'''Raise this exception to mark a test as a known failing test.'''
pass
class KnownFailure(ErrorClassPlugin):
'''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 failure.'''
enabled = True
knownfail = ErrorClass(KnownFailureTest,
label='KNOWNFAIL',
isfailure=False)
def options(self, parser, env=os.environ):
env_opt = 'NOSE_WITHOUT_KNOWNFAIL'
parser.add_option('--no-knownfail', action='store_true',
dest='noKnownFail', default=env.get(env_opt, False),
help='Disable special handling of KnownFailureTest '
'exceptions')
def configure(self, options, conf):
if not self.can_configure:
return
self.conf = conf
disable = getattr(options, 'noKnownFail', False)
if disable:
self.enabled = False