root/galaxy-central/eggs/nose-0.11.1-py2.6.egg/nose/failure.py

リビジョン 3, 1.1 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1import logging
2import unittest
3from traceback import format_tb
4
5log = logging.getLogger(__name__)
6
7
8__all__ = ['Failure']
9
10
11class Failure(unittest.TestCase):
12    """Unloadable or unexecutable test.
13
14    A Failure case is placed in a test suite to indicate the presence of a
15    test that could not be loaded or executed. A common example is a test
16    module that fails to import.
17   
18    """
19    __test__ = False # do not collect
20    def __init__(self, exc_class, exc_val, tb=None, address=None):
21        log.debug("A failure! %s %s %s", exc_class, exc_val, format_tb(tb))
22        self.exc_class = exc_class
23        self.exc_val = exc_val
24        self.tb = tb
25        self._address = address
26        unittest.TestCase.__init__(self)
27
28    def __str__(self):
29        return "Failure: %s (%s)" % (
30            getattr(self.exc_class, '__name__', self.exc_class), self.exc_val)
31
32    def address(self):
33        return self._address
34   
35    def runTest(self):
36        if self.tb is not None:           
37            raise self.exc_class, self.exc_val, self.tb
38        else:
39            raise self.exc_class(self.exc_val)
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。