Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/nose/plugins/base.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�9�c@sxddlZddlZddlmZddlmZddlmZdefd��YZ	defd��YZ
dS(	i�N(tOptionConflictError(twarn(ttolisttPlugincBsqeZdZeZeZd	Zd	ZdZ	d�Z
d	d�Zd	d�Zd�Z
d�Zd�Zd�ZRS(
s�Base class for nose plugins. It's recommended but not *necessary* to
    subclass this class to create a plugin, but all plugins *must* implement
    `options(self, parser, env)` and `configure(self, options, conf)`, and
    must have the attributes `enabled`, `name` and `score`.  The `name`
    attribute may contain hyphens ('-').

    Plugins should not be enabled by default.

    Subclassing Plugin (and calling the superclass methods in
    __init__, configure, and options, if you override them) will give
    your plugin some friendly default behavior:

    * A --with-$name option will be added to the command line interface
      to enable the plugin, and a corresponding environment variable
      will be used as the default value. The plugin class's docstring
      will be used as the help for this option.
    * The plugin will not be enabled unless this option is selected by
      the user.
    idcCsY|jdkr'|jjj�|_n|jdkrUd|jjdd�|_ndS(Nsenable_plugin_%st-t_(tnametNonet	__class__t__name__tlowert	enableOpttreplace(tself((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt__init__!scCs|j||�dS(s�Add command-line options for this plugin.

        The base plugin class adds --with-$name by default, used to enable the
        plugin.

        .. warning :: Don't implement addOptions unless you want to override
                      all default option handling behavior, including
                      warnings for conflicting options. Implement
                      :meth:`options
                      <nose.plugins.base.IPluginInterface.options>`
                      instead.
        N(tadd_options(R
tparsertenv((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt
addOptions's
cCsx|dkrtj}ny|j||�t|_Wn<tk
rs}td||ft�t	|_
t	|_nXdS(s�Non-camel-case version of func name for backwards compatibility.

        .. warning ::

           DEPRECATED: Do not use this method,
           use :meth:`options <nose.plugins.base.IPluginInterface.options>`
           instead.

        s@Plugin %s has conflicting option string: %s and will be disabledN(RtostenvirontoptionstTruet
can_configureRRtRuntimeWarningtFalsetenabled(R
RRte((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyR6s
	c
Cszd|jj�}|jdd�}|jd|jddd|jd|j|�d	d
|jj|j�|f�dS(sRegister commandline options.

        Implement this method for normal options behavior with protection from
        OptionConflictErrors. If you override this method and want the default
        --with-$name option to be registered, be sure to call super().
        sNOSE_WITH_%sRRs	--with-%stactiont
store_truetdesttdefaultthelpsEnable plugin %s: %s [%s]N(	RtupperRt
add_optionRtgetRR	R (R
RRtenv_opt((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyRLs	cCsD|js
dS||_t||j�r@t||j�|_ndS(s�Configure the plugin and system, based on selected options.

        The base plugin class sets the plugin to enabled if the enable option
        for the plugin (self.enableOpt) is true.
        N(RtconfthasattrRtgetattrR(R
RR%((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt	configure\s
		cCs#|jjrtj|jj�SdS(s�Return help for this plugin. This will be output as the help
        section of the --with-$name option that enables the plugin.
        s(no help available)(Rt__doc__ttextwraptdedent(R
((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyR hscCstdt�t|�S(Ns9Plugin.tolist is deprecated. Use nose.util.tolist instead(RtDeprecationWarningR(R
tval((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyRrsN(R	t
__module__R)RRRRRRtscoreRRRRR(R R(((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyRs				
tIPluginInterfacecBs�eZdZd�Zd�ZeZee_d�Zee_d�Z	ee	_
d�Zee_
d�Zee_d�Z
ee
_
d�Zee_d	�Zee_d
�Zee_d�Zee_d�Zee_d
�Zee_d�Zee_d�Zee_d�Zd�Zd�Zd�Zee_d�Zee_ee_eefe_d�Zee_ee_eefe_d�Z ee _d�Z!ee!_d�Z"ee"_#ee"_d5d�Z%ee%_#d5d5d�Z&ee&_#d5d�Z'ee'_ee'_d�Z(ee(_#ee(_d�Z)ee)_d�Z*ee*_#d�Z+ee+_ee+_#d �Z,ee,_ee,_#d!�Z-ee-_d"�Z.d#�Z/ee/_d$�Z0ee0_d%�Z1ee1_d&�Z2ee2_d'�Z3d(�Z4d)�Z5ee5_d*�Z6d+�Z7ee7_d,�Z8d-�Z9ee9_d.�Z:d/�Z;d0�Z<d1�Z=d2�Z>d3�Z?d4�Z@ee@_RS(6sd
    IPluginInterface describes the plugin API. Do not subclass or use this
    class directly.
    cOstd��dS(Ns0IPluginInterface class is for documentation only(t	TypeError(tclstargtkw((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt__new__}scCsdS(sZCalled to allow plugin to register command-line options with the
        parser. DO NOT return a value from this method unless you want to stop
        all other plugins from setting their options.

        .. warning ::

           DEPRECATED -- implement
           :meth:`options <nose.plugins.base.IPluginInterface.options>` instead.
        N((R
RR((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyR�s
cCsdS(s�Called when a deprecated test is seen. DO NOT return a value
        unless you want to stop other plugins from seeing the deprecated
        test.

        .. warning :: DEPRECATED -- check error class in addError instead
        N((R
ttest((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt
addDeprecated�scCsdS(sTCalled when a test raises an uncaught exception. DO NOT return a
        value unless you want to stop other plugins from seeing that the
        test has raised an error.

        :param test: the test case
        :type test: :class:`nose.case.Test`            
        :param err: sys.exc_info() tuple
        :type err: 3-tuple
        N((R
R6terr((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytaddError�s
cCsdS(s Called when a test fails. DO NOT return a value unless you
        want to stop other plugins from seeing that the test has failed.

        :param test: the test case
        :type test: :class:`nose.case.Test`
        :param err: 3-tuple
        :type err: sys.exc_info() tuple
        N((R
R6R8((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt
addFailure�s	cCsdS(s�Called when a test is skipped. DO NOT return a value unless
        you want to stop other plugins from seeing the skipped test.

        .. warning:: DEPRECATED -- check error class in addError instead
        N((R
R6((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytaddSkip�scCsdS(s�Called when a test passes. DO NOT return a value unless you
        want to stop other plugins from seeing the passing test.

        :param test: the test case
        :type test: :class:`nose.case.Test`
        N((R
R6((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt
addSuccess�scCsdS(s�Called after a context (generally a module) has been
        lazy-loaded, imported, setup, had its tests loaded and
        executed, and torn down.
        N((R
((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytafterContext�scCsdS(s�Called after all tests have been loaded from directory at path
        and run.

        :param path: the directory that has finished processing
        :type path: string
        N((R
tpath((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytafterDirectory�scCsdS(s
Called after module is imported from filename. afterImport
        is called even if the import failed.

        :param filename: The file that was loaded
        :type filename: string
        :param module: The name of the module
        :type module: string
        N((R
tfilenametmodule((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytafterImport�s	cCsdS(s�Called after the test has been run and the result recorded
        (after stopTest).

        :param test: the test case
        :type test: :class:`nose.case.Test`
        N((R
R6((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt	afterTest�scCsdS(s�Called before a context (generally a module) is
        examined. Because the context is not yet loaded, plugins don't
        get to know what the context is; so any context operations
        should use a stack that is pushed in `beforeContext` and popped
        in `afterContext` to ensure they operate symmetrically.

        `beforeContext` and `afterContext` are mainly useful for tracking
        and restoring global state around possible changes from within a
        context, whatever the context may be. If you need to operate on
        contexts themselves, see `startContext` and `stopContext`, which
        are passed the context in question, but are called after
        it has been loaded (imported in the module case).
        N((R
((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt
beforeContext�scCsdS(s�Called before tests are loaded from directory at path.

        :param path: the directory that is about to be processed
        N((R
R>((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytbeforeDirectory�scCsdS(s�Called before module is imported from filename.

        :param filename: The file that will be loaded
        :param module: The name of the module found in file
        :type module: string
        N((R
R@RA((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytbeforeImportscCsdS(s�Called before the test is run (before startTest).

        :param test: the test case
        :type test: :class:`nose.case.Test`
        N((R
R6((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt
beforeTestscCsdS(szCalled before any tests are collected or run. Use this to
        perform any setup needed before testing begins.
        N((R
((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytbeginscCsdS(sdCalled after the command line has been parsed, with the
        parsed options and the config container. Here, implement any
        config storage or changes to state or operation that are set
        by command line options.

        DO NOT return a value from this method unless you want to
        stop all other plugins from being configured.
        N((R
RR%((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyR(s	cCsdS(sKCalled after all report output, including output from all
        plugins, has been sent to the stream. Use this to print final
        test results or perform final cleanup. Return None to allow
        other plugins to continue printing, or any other value to stop
        them.

        :param result: test result object
        
        .. Note:: When tests are run under a test runner other than
           :class:`nose.core.TextTestRunner`, such as
           via ``python setup.py test``, this method may be called
           **before** the default report output is sent.
        N((R
tresult((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytfinalize(scCsdS(s�Return a test description.

        Called by :meth:`nose.case.Test.shortDescription`.

        :param test: the test case
        :type test: :class:`nose.case.Test`
        N((R
R6((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytdescribeTest8scCsdS(scCalled in result.addError, before plugin.addError. If you
        want to replace or modify the error tuple, return a new error
        tuple, otherwise return err, the original error tuple.
        
        :param test: the test case
        :type test: :class:`nose.case.Test`
        :param err: sys.exc_info() tuple
        :type err: 3-tuple
        N((R
R6R8((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytformatErrorCs
cCsdS(sgCalled in result.addFailure, before plugin.addFailure. If you
        want to replace or modify the error tuple, return a new error
        tuple, otherwise return err, the original error tuple.
        
        :param test: the test case
        :type test: :class:`nose.case.Test`
        :param err: sys.exc_info() tuple
        :type err: 3-tuple
        N((R
R6R8((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt
formatFailureSs
cCsdS(sCalled on addError. To handle the error yourself and prevent normal
        error processing, return a true value.

        :param test: the test case
        :type test: :class:`nose.case.Test`
        :param err: sys.exc_info() tuple
        :type err: 3-tuple
        N((R
R6R8((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pythandleErrorcs	cCsdS(sCalled on addFailure. To handle the failure yourself and
        prevent normal failure processing, return a true value.

        :param test: the test case
        :type test: :class:`nose.case.Test`
        :param err: sys.exc_info() tuple
        :type err: 3-tuple
        N((R
R6R8((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt
handleFailureos	cCsdS(s@Return iterable of tests from a directory. May be a
        generator.  Each item returned must be a runnable
        unittest.TestCase (or subclass) instance or suite instance.
        Return None if your plugin cannot collect any tests from
        directory.

        :param  path: The path to the directory.
        N((R
R>((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytloadTestsFromDir{s	cCsdS(s/Return iterable of tests in a module. May be a
        generator. Each item returned must be a runnable
        unittest.TestCase (or subclass) instance.
        Return None if your plugin cannot
        collect any tests from module.

        :param module: The module object
        :type module: python module
        :param path: the path of the module to search, to distinguish from
            namespace package modules

            .. note::

               NEW. The ``path`` parameter will only be passed by nose 0.11
               or above.
        N((R
RAR>((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytloadTestsFromModule�scCsdS(s�Return tests in this file or module. Return None if you are not able
        to load any tests, or an iterable if you are. May be a
        generator.

        :param name: The test name. May be a file or module name plus a test
            callable. Use split_test_name to split into parts. Or it might
            be some crazy name of your own devising, in which case, do
            whatever you want.
        :param module: Module from which the name is to be loaded
        :param importPath: Path from which file (must be a python module) was
            found

            .. warning:: DEPRECATED: this argument will NOT be passed.
        N((R
RRAt
importPath((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytloadTestsFromName�scCsdS(s�Return a tuple of (tests loaded, remaining names). Return
        None if you are not able to load any tests. Multiple plugins
        may implement loadTestsFromNames; the remaining name list from
        each will be passed to the next as input.

        :param names: List of test names.
        :type names: iterable
        :param module: Module from which the names are to be loaded
        N((R
tnamesRA((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytloadTestsFromNames�s
cCsdS(s�Return tests in this file. Return None if you are not
        interested in loading any tests, or an iterable if you are and
        can load some. May be a generator. *If you are interested in
        loading tests from the file and encounter no errors, but find
        no tests, yield False or return [False].*

        .. Note:: This method replaces loadTestsFromPath from the 0.9
                  API.

        :param filename: The full path to the file or directory.
        N((R
R@((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytloadTestsFromFile�scCsdS(sJ
        .. warning:: DEPRECATED -- use loadTestsFromFile instead
        N((R
R>((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytloadTestsFromPath�scCsdS(sReturn tests in this test case class. Return None if you are
        not able to load any tests, or an iterable if you are. May be a
        generator.

        :param cls: The test case class. Must be subclass of
           :class:`unittest.TestCase`.
        N((R
R2((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytloadTestsFromTestCase�scCsdS(s:Return tests in this test class. Class will *not* be a
        unittest.TestCase subclass. Return None if you are not able to
        load any tests, an iterable if you are. May be a generator.

        :param cls: The test case class. Must be **not** be subclass of
           :class:`unittest.TestCase`.
        N((R
R2((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytloadTestsFromTestClass�scCsdS(s�Given an object and its parent, return or yield one or more
        test cases. Each test must be a unittest.TestCase (or subclass)
        instance. This is called before default test loading to allow
        plugins to load an alternate test case or cases for an
        object. May be a generator.

        :param obj: The object to be made into a test
        :param parent: The parent of obj (eg, for a method, the class)
        N((R
tobjtparent((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytmakeTest�s
cCsdS(swCalled to allow plugin to register command line
        options with the parser.

        DO NOT return a value from this method unless you want to stop
        all other plugins from setting their options.

        :param parser: options parser instance
        :type parser: :class:`ConfigParser.ConfigParser`
        :param env: environment, default is os.environ
        N((R
RR((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyR�scCsdS(s�Called before the test is run by the test runner. Please
        note the article *the* in the previous sentence: prepareTest
        is called *only once*, and is passed the test case or test
        suite that the test runner will execute. It is *not* called
        for each individual test case. If you return a non-None value,
        that return value will be run as the test. Use this hook to
        wrap or decorate the test with another function. If you need
        to modify or wrap individual test cases, use `prepareTestCase`
        instead.

        :param test: the test case
        :type test: :class:`nose.case.Test`
        N((R
R6((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytprepareTestscCsdS(s�Prepare or wrap an individual test case. Called before
        execution of the test. The test passed here is a
        nose.case.Test instance; the case to be executed is in the
        test attribute of the passed case. To modify the test to be
        run, you should return a callable that takes one argument (the
        test result object) -- it is recommended that you *do not*
        side-effect the nose.case.Test instance you have been passed.

        Keep in mind that when you replace the test callable you are
        replacing the run() method of the test case -- including the
        exception handling and result calls, etc.

        :param test: the test case
        :type test: :class:`nose.case.Test`
        N((R
R6((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytprepareTestCasescCsdS(shCalled before tests are loaded. To replace the test loader,
        return a test loader. To allow other plugins to process the
        test loader, return None. Only one plugin may replace the test
        loader. Only valid when using nose.TestProgram.

        :param loader: :class:`nose.loader.TestLoader` 
             (or other loader) instance
        N((R
tloader((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytprepareTestLoader)s	cCsdS(sbCalled before the first test is run. To use a different
        test result handler for all tests than the given result,
        return a test result handler. NOTE however that this handler
        will only be seen by tests, that is, inside of the result
        proxy system. The TestRunner and TestProgram -- whether nose's
        or other -- will continue to see the original result
        handler. For this reason, it is usually better to monkeypatch
        the result (for instance, if you want to handle some
        exceptions in a unique way). Only one plugin may replace the
        result, but many may monkeypatch it. If you want to
        monkeypatch and stop other plugins from doing so, monkeypatch
        and return the patched result.

        :param result: :class:`nose.result.TextTestResult` 
             (or other result) instance
        N((R
RI((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytprepareTestResult5scCsdS(s2Called before tests are run. To replace the test runner,
        return a test runner. To allow other plugins to process the
        test runner, return None. Only valid when using nose.TestProgram.

        :param runner: :class:`nose.core.TextTestRunner` 
             (or other runner) instance
        N((R
trunner((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytprepareTestRunnerIscCsdS(s2Called after all error output has been printed. Print your
        plugin's report to the provided stream. Return None to allow
        other plugins to print reports, any other value to stop them.

        :param stream: stream object; send your output here
        :type stream: file-like object
        N((R
tstream((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytreportTscCsdS(sdCalled before test output begins. To direct test output to a
        new stream, return a stream object, which must implement a
        `write(msg)` method. If you only want to note the stream, not
        capture or redirect it, then return None.

        :param stream: stream object; send your output here
        :type stream: file-like object
        N((R
Rd((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytsetOutputStream^scCsdS(s3Called before context setup and the running of tests in the
        context. Note that tests have already been *loaded* from the
        context before this call.

        :param context: the context about to be setup. May be a module or
             class, or any other object that contains tests.
        N((R
tcontext((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytstartContexthscCsdS(s�Called before each test is run. DO NOT return a value unless
        you want to stop other plugins from seeing the test start.

        :param test: the test case
        :type test: :class:`nose.case.Test`
        N((R
R6((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt	startTestsscCsdS(s�Called after the tests in a context have run and the
        context has been torn down.

        :param context: the context that has been torn down. May be a module or
             class, or any other object that contains tests.
        N((R
Rg((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytstopContext|scCsdS(s�Called after each test is run. DO NOT return a value unless
        you want to stop other plugins from seeing that the test has stopped.

        :param test: the test case
        :type test: :class:`nose.case.Test`
        N((R
R6((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytstopTest�scCsdS(s�Return a short test name. Called by `nose.case.Test.__str__`.

        :param test: the test case
        :type test: :class:`nose.case.Test`
        N((R
R6((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyttestName�scCsdS(s�Return true if you want the main test selector to collect
        tests from this class, false if you don't, and None if you don't
        care.

        :param cls: The class being examined by the selector
        N((R
R2((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt	wantClass�scCsdS(s�Return true if you want test collection to descend into this
        directory, false if you do not, and None if you don't care.

        :param dirname: Full path to directory being examined by the selector
        N((R
tdirname((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt
wantDirectory�scCsdS(sReturn true if you want to collect tests from this file,
        false if you do not and None if you don't care.

        Change from 0.9: The optional package parameter is no longer passed.

        :param file: Full path to file being examined by the selector
        N((R
tfile((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytwantFile�scCsdS(s�Return true to collect this function as a test, false to
        prevent it from being collected, and None if you don't care.

        :param function: The function object being examined by the selector
        N((R
tfunction((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytwantFunction�scCsdS(s�Return true to collect this method as a test, false to
        prevent it from being collected, and None if you don't care.
        
        :param method: The method object being examined by the selector
        :type method: unbound method
        N((R
tmethod((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt
wantMethod�scCsdS(s$Return true if you want to collection to descend into this
        module, false to prevent the collector from descending into the
        module, and None if you don't care.

        :param module: The module object being examined by the selector
        :type module: python module
        N((R
RA((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt
wantModule�scCsdS(s�
        .. warning:: DEPRECATED -- this method will not be called, it has
                     been folded into wantModule.
        N((R
RA((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pytwantModuleTests�sN(AR	R.R)R5RRRt
deprecatedR7R9tchangedR:R;R<R=t_newR?RBRCRDRERFRGRHR(RJRKRLt	chainableRtstatic_argsRMRNRORPt
generativeRRQRSRURVRWRXRYR\RR]R^R`RaRcReRfRhRiRjRkRlRmRoRqRsRuRvRw(((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyR0xs�								
										
																								
		
		
							
																				
							
	
															
				
	(RR*toptparseRtwarningsRt	nose.utilRtobjectRR0(((s5/sys/lib/python2.7/site-packages/nose/plugins/base.pyt<module>sq

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.