root/galaxy-central/eggs/nose-0.11.1-py2.6.egg/nose/plugins/skip.py @ 3

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

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

行番号 
1"""
2This plugin installs a SKIP error class for the SkipTest exception.
3When SkipTest is raised, the exception will be logged in the skipped
4attribute of the result, 'S' or 'SKIP' (verbose) will be output, and
5the exception will not be counted as an error or failure. This plugin
6is enabled by default but may be disabled with the ``--no-skip`` option.
7"""
8   
9from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin
10
11
12class SkipTest(Exception):
13    """Raise this exception to mark a test as skipped.
14    """
15    pass
16
17
18class Skip(ErrorClassPlugin):
19    """
20    Plugin that installs a SKIP error class for the SkipTest
21    exception.  When SkipTest is raised, the exception will be logged
22    in the skipped attribute of the result, 'S' or 'SKIP' (verbose)
23    will be output, and the exception will not be counted as an error
24    or failure.
25    """
26    enabled = True
27    skipped = ErrorClass(SkipTest,
28                         label='SKIP',
29                         isfailure=False)
30
31    def options(self, parser, env):
32        """
33        Add my options to command line.
34        """
35        env_opt = 'NOSE_WITHOUT_SKIP'
36        parser.add_option('--no-skip', action='store_true',
37                          dest='noSkip', default=env.get(env_opt, False),
38                          help="Disable special handling of SkipTest "
39                          "exceptions.")
40
41    def configure(self, options, conf):
42        """
43        Configure plugin. Skip plugin is enabled by default.
44        """
45        if not self.can_configure:
46            return
47        self.conf = conf
48        disable = getattr(options, 'noSkip', False)
49        if disable:
50            self.enabled = False
51           
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。