/usr/lib/python2.6/site-packages/nose
NameSizeModeActions
ext/-0755rm
plugins/-0755rm
case.py125080644editdlrm
case.pyc142820644editdlrm
case.pyo142820644editdlrm
commands.py45700644editdlrm
commands.pyc50030644editdlrm
commands.pyo50030644editdlrm
config.py202030644editdlrm
config.pyc198900644editdlrm
config.pyo198900644editdlrm
core.py171750644editdlrm
core.pyc175490644editdlrm
core.pyo175490644editdlrm
exc.py3760644editdlrm
exc.pyc5760644editdlrm
exc.pyo5760644editdlrm
failure.py8500644editdlrm
failure.pyc13670644editdlrm
failure.pyo13670644editdlrm
importer.py54900644editdlrm
importer.pyc50940644editdlrm
importer.pyo50940644editdlrm
inspector.py69040644editdlrm
inspector.pyc59250644editdlrm
inspector.pyo59250644editdlrm
loader.py214370644editdlrm
loader.pyc160800644editdlrm
loader.pyo160800644editdlrm
proxy.py58400644editdlrm
proxy.pyc73270644editdlrm
proxy.pyo71200644editdlrm
result.py58490644editdlrm
result.pyc59130644editdlrm
result.pyo59130644editdlrm
selector.py90030644editdlrm
selector.pyc88760644editdlrm
selector.pyo88760644editdlrm
suite.py186930644editdlrm
suite.pyc186630644editdlrm
suite.pyo186630644editdlrm
tools.py50230644editdlrm
tools.pyc72090644editdlrm
tools.pyo71290644editdlrm
twistedtools.py52680644editdlrm
twistedtools.pyc58150644editdlrm
twistedtools.pyo58150644editdlrm
util.py192750644editdlrm
util.pyc201250644editdlrm
util.pyo201250644editdlrm
__init__.py149850644editdlrm
__init__.pyc152830644editdlrm
__init__.pyo152830644editdlrm
Edit: /usr/lib/python2.6/site-packages/nose/result.py (5849B)
""" Test Result ----------- Provides a TextTestResult that extends unittest._TextTestResult to provide support for error classes (such as the builtin skip and deprecated classes), and hooks for plugins to take over or extend reporting. """ import logging from unittest import _TextTestResult from nose.config import Config from nose.util import isclass, ln as _ln # backwards compat log = logging.getLogger('nose.result') def _exception_detail(exc): # this is what stdlib module traceback does try: return str(exc) except: return '' % type(exc).__name__ class TextTestResult(_TextTestResult): """Text test result that extends unittest's default test result support for a configurable set of errorClasses (eg, Skip, Deprecated, TODO) that extend the errors/failures/success triad. """ def __init__(self, stream, descriptions, verbosity, config=None, errorClasses=None): if errorClasses is None: errorClasses = {} self.errorClasses = errorClasses if config is None: config = Config() self.config = config _TextTestResult.__init__(self, stream, descriptions, verbosity) def addError(self, test, err): """Overrides normal addError to add support for errorClasses. If the exception is a registered class, the error will be added to the list for that class, not errors. """ stream = getattr(self, 'stream', None) ec, ev, tb = err try: exc_info = self._exc_info_to_string(err, test) except TypeError: # 2.3 compat exc_info = self._exc_info_to_string(err) for cls, (storage, label, isfail) in self.errorClasses.items(): if isclass(ec) and issubclass(ec, cls): storage.append((test, exc_info)) # Might get patched into a streamless result if stream is not None: if self.showAll: message = [label] detail = _exception_detail(err[1]) if detail: message.append(detail) stream.writeln(": ".join(message)) elif self.dots: stream.write(label[:1]) return self.errors.append((test, exc_info)) if stream is not None: if self.showAll: self.stream.writeln('ERROR') elif self.dots: stream.write('E') def printErrors(self): """Overrides to print all errorClasses errors as well. """ _TextTestResult.printErrors(self) for cls in self.errorClasses.keys(): storage, label, isfail = self.errorClasses[cls] if isfail: self.printErrorList(label, storage) # Might get patched into a result with no config if hasattr(self, 'config'): self.config.plugins.report(self.stream) def printSummary(self, start, stop): """Called by the test runner to print the final summary of test run results. """ write = self.stream.write writeln = self.stream.writeln taken = float(stop - start) run = self.testsRun plural = run != 1 and "s" or "" writeln(self.separator2) writeln("Ran %s test%s in %.3fs" % (run, plural, taken)) writeln() summary = {} eckeys = self.errorClasses.keys() eckeys.sort() for cls in eckeys: storage, label, isfail = self.errorClasses[cls] count = len(storage) if not count: continue summary[label] = count if len(self.failures): summary['failures'] = len(self.failures) if len(self.errors): summary['errors'] = len(self.errors) if not self.wasSuccessful(): write("FAILED") else: write("OK") items = summary.items() if items: items.sort() write(" (") write(", ".join(["%s=%s" % (label, count) for label, count in items])) writeln(")") else: writeln() def wasSuccessful(self): """Overrides to check that there are no errors in errorClasses lists that are marked as errors that should cause a run to fail. """ if self.errors or self.failures: return False for cls in self.errorClasses.keys(): storage, label, isfail = self.errorClasses[cls] if not isfail: continue if storage: return False return True def _addError(self, test, err): try: exc_info = self._exc_info_to_string(err, test) except TypeError: # 2.3: does not take test arg exc_info = self._exc_info_to_string(err) self.errors.append((test, exc_info)) if self.showAll: self.stream.write('ERROR') elif self.dots: self.stream.write('E') def _exc_info_to_string(self, err, test=None): # 2.3/2.4 -- 2.4 passes test, 2.3 does not try: return _TextTestResult._exc_info_to_string(self, err, test) except TypeError: # 2.3: does not take test arg return _TextTestResult._exc_info_to_string(self, err) def ln(*arg, **kw): from warnings import warn warn("ln() has moved to nose.util from nose.result and will be removed " "from nose.result in a future release. Please update your imports ", DeprecationWarning) return _ln(*arg, **kw)