HEX
Server: Apache
System: Linux sg241.singhost.net 2.6.32-896.16.1.lve1.4.51.el6.x86_64 #1 SMP Wed Jan 17 13:19:23 EST 2018 x86_64
User: honghock (909)
PHP: 8.0.30
Disabled: passthru,system,shell_exec,show_source,exec,popen,proc_open
Upload Files
File: //usr/lib/python2.6/site-packages/nose/plugins/deprecated.py
"""
This plugin installs a DEPRECATED error class for the DeprecatedTest
exception. It is enabled by default. When DeprecatedTest is raised, the
exception will be logged in the deprecated attribute of the result,
'D' or 'DEPRECATED' (verbose) will be output, and the exception will
not be counted as an error or failure.
"""

import os
from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin


class DeprecatedTest(Exception):
    """Raise this exception to mark a test as deprecated.
    """
    pass


class Deprecated(ErrorClassPlugin):
    """
    Plugin that installs a DEPRECATED error class for the DeprecatedTest
    exception. Enabled by default. When DeprecatedTest is raised, the
    exception will be logged in the deprecated attribute of the result, 'D' or
    'DEPRECATED' (verbose) will be output, and the exception will not be
    counted as an error or failure.
    """
    enabled = True
    deprecated = ErrorClass(DeprecatedTest,
                            label='DEPRECATED',
                            isfailure=False)

    def options(self, parser, env=os.environ):
        env_opt = 'NOSE_WITHOUT_DEPRECATED'
        parser.add_option('--no-deprecated', action='store_true',
                          dest='noDeprecated', default=env.get(env_opt, False),
                          help="Disable special handling of DeprecatedTest "
                          "exceptions.")

    def configure(self, options, conf):
        if not self.can_configure:
            return
        self.conf = conf
        disable = getattr(options, 'noDeprecated', False)
        if disable:
            self.enabled = False