HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //proc/self/root/opt/alt/python37/lib/python3.7/site-packages/nose/__pycache__/core.cpython-37.pyc
B

9�`3�@sdZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
ddlmZm
Z
mZddlmZddlmZddlmZmZe�d	�Zejd
kZddd
ddddgZGdd�dej�ZGdd�dej�ZeZZdd
�Zddd�Z dd�Z!e"dk�re�dS)z,Implements nose test program and collector.
�N)�Config�all_config_files)�defaultTestLoader)�
PluginManager�DefaultPluginManager�RestrictedPluginManager)�TextTestResult)�FinalizingSuiteWrapper)�isclass�tolistz	nose.core)���TestProgram�main�run�run_exit�	runmodule�	collector�TextTestRunnerc@s4eZdZdZejdddfdd�Zdd�Zdd	�ZdS)
rz�Test runner that uses nose's TextTestResult to enable errorClasses,
    as well as providing hooks for plugins to override or replace the test
    output stream, results, and the test case itself.
    �NcCs*|dkrt�}||_tj�||||�dS)N)r�config�unittestr�__init__)�self�stream�descriptions�	verbosityr�r�:/opt/alt/python37/lib/python3.7/site-packages/nose/core.pyr szTextTestRunner.__init__cCst|j|j|j|j�S)N)rrrrr)rrrr�_makeResult(szTextTestRunner._makeResultcCs�|jj�|�}|dk	r|}|jj�|j�}|dk	r8||_|��}t��}y||�Wntk
rhYnXt��}|��|�	||�|jj�
|�|S)zaOverrides to provide plugin hooks and defer all output to
        the test result class.
        N)r�plugins�prepareTest�setOutputStreamrr�time�KeyboardInterruptZprintErrorsZprintSummary�finalize)r�test�wrapper�wrapped�result�start�stoprrrr.s"zTextTestRunner.run)	�__name__�
__module__�__qualname__�__doc__�sys�stderrrrrrrrrrs
c@sbeZdZdZdZddd�Zddd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Ze
e�ZdS)ra�Collect and run tests, returning success or failure.

    The arguments to TestProgram() are the same as to
    :func:`main()` and :func:`run()`:

    * module: All tests are in this module (default: None)
    * defaultTest: Tests to load (default: '.')
    * argv: Command line arguments (default: None; sys.argv is read)
    * testRunner: Test runner instance (default: None)
    * testLoader: Test loader instance (default: None)
    * env: Environment; ignored if config is provided (default: None;
      os.environ is read)
    * config: :class:`nose.config.Config` instance (default: None)
    * suite: Suite or list of tests to run (default: None). Passing a
      suite or lists of tests will bypass all test discovery and
      loading. *ALSO NOTE* that if you pass a unittest.TestSuite
      instance as the suite, context fixtures at the class, module and
      package level will not be used, and many plugin hooks will not
      be called. If you want normal nose behavior, either pass a list
      of tests, or a fully-configured :class:`nose.suite.ContextSuite`.
    * exit: Exit after running tests and printing report (default: True)
    * plugins: List of plugins to use; ignored if config is provided
      (default: load plugins with DefaultPluginManager)
    * addplugins: List of **extra** plugins to use. Pass a list of plugin
      instances in this argument to make custom plugins available while
      still using the DefaultPluginManager.
    rN�.TcCs�|dkrtj}|dkr"|�||
�}|r4|jj|d�||_||_|	|_i}tj	dd�}
|
dkrp|
dkrp|	|d<t
jj|f|||||d�|��dS)N)Zextrapluginsrr)r�)�r�exit)�module�defaultTest�argv�
testRunner�
testLoader)
�os�environ�
makeConfigr Z
addPluginsr�suiter5r0�version_inforrr)rr6r7r8r9r:�envrr>r5r Z
addpluginsZ
extra_args�versionrrrrfs"
zTestProgram.__init__cCs"|pi}|�dd�rgSt�SdS)NZNOSE_IGNORE_CONFIG_FILESF)�getr)rr@rrr�getAllConfigFiles{szTestProgram.getAllConfigFilescCs.|�|�}|rt|d�}nt�}t|||d�S)zSLoad a Config, pre-filled with user config files if any are
        found.
        )r )r@�filesr )rCrrr)rr@r Z	cfg_filesZmanagerrrrr=�s
zTestProgram.makeConfigcCsH|jj||��d�t�d|j�|jjjrhddlm}t	j
t	_tdt
j�t	jd�|f�t	�d�|jjjr�|��t	�d�|jdkr�t|jd�|_nt|j�r�|j|jd�|_|jj�|j�}|dk	r�||_t�d|j�|jjr�|jj|_nt|j�|_t�d	|j�t�d
|j�|jjdk	�r<t
�|jj�|��dS)z>Parse argv and env and configure running environment.
        )�docz
configured %sr)�__version__z
%s version %sN)rztest loader is %szdefaultTest %szTest names are %s)r�	configure�usage�log�debug�optionsrA�noserFr0�
__stdout__�stdout�printr;�path�basenamer8r5�showPluginsr:rr
r �prepareTestLoader�	testNamesrr7Z
workingDir�chdir�createTests)rr8rFZplug_loaderrrr�	parseArgs�s4





zTestProgram.parseArgscCs>t�d|j�|jdk	r*|j�|j�|_n|j�|j�|_dS)z�Create the tests to run. If a self.suite
        is set, then that suite will be used. Otherwise, tests will be
        loaded from the given test names (self.testNames) using the
        test loader.
        zcreateTests called with %sN)rIrJr>r:Z
suiteClassr&�loadTestsFromNamesrT)rrrrrV�s
zTestProgram.createTestscCs~t�d�|jdkr.t|jj|jj|jd�|_|jj�|j�}|dk	rL||_|j�	|j
�}|��|_|j
rxt�
|j�|jS)zoRun Tests. Returns true on success, false on failure, and sets
        self.success to the same value.
        zrunTests calledN)rrr)rIrJr9rrrrr �prepareTestRunnerrr&Z
wasSuccessful�successr5r0)rZplug_runnerr)rrr�runTests�s


zTestProgram.runTestsc
Csddl}Gdd�d�}|jj}|jj��x�|jjD]�}td|j�|dkr4td|j�td�|j	|�
���d	d	d
���|dkr�|�}|�|�t
|j�r�t�td�xF|jD]<\}}td
d�|��|r�td�|j	|��ddd
���q�Wt�q4WdS)z)Print list of available plugins.
        rNc@seZdZdd�Zdd�ZdS)z,TestProgram.showPlugins.<locals>.DummyParsercSs
g|_dS)N)rK)rrrrr�sz5TestProgram.showPlugins.<locals>.DummyParser.__init__c_s|j�||�dd�f�dS)N�help�)rK�append�pop)r�arg�kwrrr�
add_option�sz7TestProgram.showPlugins.<locals>.DummyParser.add_optionN)r,r-r.rrbrrrr�DummyParser�srcz	Plugin %srz  score: %s�
z  )Zinitial_indentZsubsequent_indentr4z
  Options:z  %sz, z    )�textwraprrr �sortrO�nameZscore�joinZwrapr\�stripZ
addOptions�lenrK)rrerc�v�p�parserZoptsr\rrrrR�s2


zTestProgram.showPluginscCs�ddl}y&|j}|�tj�tj�t�d��}WnHtk
rvt	tj�tj�t�d�d�}z|�
�}Wd|��XYnXt|t
�s�|�d�}|S)Nrz	usage.txt�rzutf-8)rL�
__loader__�get_datar;rPrh�dirname�__file__�AttributeError�open�read�close�
isinstance�str�decode)�clsrLZld�text�frrrrH�s


zTestProgram.usage)Nr2NNNNNNTNN)N)N)r,r-r.r/rrrCr=rWrVr[rRrH�classmethodrrrrrHs


'#cOsd|d<t||�jS)a�Collect and run tests, returning success or failure.

    The arguments to `run()` are the same as to `main()`:

    * module: All tests are in this module (default: None)
    * defaultTest: Tests to load (default: '.')
    * argv: Command line arguments (default: None; sys.argv is read)
    * testRunner: Test runner instance (default: None)
    * testLoader: Test loader instance (default: None)
    * env: Environment; ignored if config is provided (default: None;
      os.environ is read)
    * config: :class:`nose.config.Config` instance (default: None)
    * suite: Suite or list of tests to run (default: None). Passing a
      suite or lists of tests will bypass all test discovery and
      loading. *ALSO NOTE* that if you pass a unittest.TestSuite
      instance as the suite, context fixtures at the class, module and
      package level will not be used, and many plugin hooks will not
      be called. If you want normal nose behavior, either pass a list
      of tests, or a fully-configured :class:`nose.suite.ContextSuite`.
    * plugins: List of plugins to use; ignored if config is provided
      (default: load plugins with DefaultPluginManager)
    * addplugins: List of **extra** plugins to use. Pass a list of plugin
      instances in this argument to make custom plugins available while
      still using the DefaultPluginManager.

    With the exception that the ``exit`` argument is always set
    to False.
    Fr5)rrZ)r`rarrrrs�__main__cKstfd|i|��dS)z�Collect and run tests in a single module only. Defaults to running
    tests in __main__. Additional arguments to TestProgram may be passed
    as keyword arguments.
    r7N)r)rgrarrrr0scCs\d}t|d�}tt�|d�}|jdgd�t|�}|jrF|�|j�}n
|�d�}t||j�S)aTestSuite replacement entry point. Use anywhere you might use a
    unittest.TestSuite. The collector will, by default, load options from
    all config files and execute loader.loadTestsFromNames() on the
    configured testNames, or '.' if no testNames are configured.
    )Zreportr!rSrYr")Zexclude)rDr r)r8)r2)	rrrrGrrTrXr	r%)Zsetuptools_incompatr Zconf�loaderr>rrrr8s


)r~)#r/Zloggingr;r0r#rZnose.configrrZnose.loaderrZnose.plugins.managerrrrZnose.resultrZ
nose.suiter	Z	nose.utilr
rZ	getLoggerrIr?Z	compat_24�__all__rrrrrrrr,rrrr�<module>s0

-E!