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

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

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

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