403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.222.24.251
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/nose/plugins/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/nose/plugins/__pycache__/testid.cpython-37.pyc
B

0�Se�&�@s�dZdZddlZddlZddlmZddlmZmZyddl	m
Z
mZWn$ek
rlddl	m
Z
mZYnXe�
e�ZGdd�de�ZdS)	a�	
This plugin adds a test id (like #1) to each test name output. After
you've run once to generate test ids, you can re-run individual
tests by activating the plugin and passing the ids (with or
without the # prefix) instead of test names.

For example, if your normal test run looks like::

  % nosetests -v
  tests.test_a ... ok
  tests.test_b ... ok
  tests.test_c ... ok

When adding ``--with-id`` you'll see::

  % nosetests -v --with-id
  #1 tests.test_a ... ok
  #2 tests.test_b ... ok
  #3 tests.test_c ... ok

Then you can re-run individual tests by supplying just an id number::

  % nosetests -v --with-id 2
  #2 tests.test_b ... ok

You can also pass multiple id numbers::

  % nosetests -v --with-id 2 3
  #2 tests.test_b ... ok
  #3 tests.test_c ... ok
  
Since most shells consider '#' a special character, you can leave it out when
specifying a test id.

Note that when run without the -v switch, no special output is displayed, but
the ids file is still written.

Looping over failed tests
-------------------------

This plugin also adds a mode that will direct the test runner to record
failed tests. Subsequent test runs will then run only the tests that failed
last time. Activate this mode with the ``--failed`` switch::

 % nosetests -v --failed
 #1 test.test_a ... ok
 #2 test.test_b ... ERROR
 #3 test.test_c ... FAILED
 #4 test.test_d ... ok
 
On the second run, only tests #2 and #3 will run::

 % nosetests -v --failed
 #2 test.test_b ... ERROR
 #3 test.test_c ... FAILED

As you correct errors and tests pass, they'll drop out of subsequent runs.

First::

 % nosetests -v --failed
 #2 test.test_b ... ok
 #3 test.test_c ... FAILED

Second::

 % nosetests -v --failed
 #3 test.test_c ... FAILED

When all tests pass, the full set will run on the next invocation.

First::

 % nosetests -v --failed
 #3 test.test_c ... ok

Second::
 
 % nosetests -v --failed
 #1 test.test_a ... ok
 #2 test.test_b ... ok
 #3 test.test_c ... ok
 #4 test.test_d ... ok

.. note ::

  If you expect to use ``--failed`` regularly, it's a good idea to always run
  using the ``--with-id`` option. This will ensure that an id file is always
  created, allowing you to add ``--failed`` to the command line as soon as
  you have failing tests. Otherwise, your first run using ``--failed`` will
  (perhaps surprisingly) run *all* tests, because there won't be an id file
  containing the record of failed tests from your previous run.
  
F�N)�Plugin)�src�set)�dump�loadc@sreZdZdZdZdZdZdZdd�Zdd	�Z	d
d�Z
ddd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)�TestIdz
    Activate to add a test id (like #1) to each test name output. Activate
    with --failed to rerun failing tests only.
    �idNTFcCs<t�|||�|jddddddd�|jdd	d
ddd
�dS)z&Register commandline options.
        z	--id-file�store�
testIdFilez.noseidsZFILEzfStore test ids found in test runs in this file. Default is the file .noseids in the working directory.)�action�dest�default�metavar�helpz--failed�
store_true�failedFz/Run the tests that failed in the last test run.)rrr
rN)r�options�
add_option)�self�parser�env�r�D/opt/alt/python37/lib/python3.7/site-packages/nose/plugins/testid.pyrxs
zTestId.optionscCs�t�|||�|jr*d|_d|_t�d�tj�	|j
�|_tj�|j�s\tj�
|j|j�|_d|_i|_i|_g|_g|_i|_|jdk|_dS)zConfigure plugin.
        TzLooping on failed tests��N)r�	configurer�enabled�loopOnFailed�log�debug�os�path�
expanduserr
�idfile�isabs�joinZ
workingDirr�ids�tests�source_names�_seen�	verbosity�
_write_hashes)rrZconfrrrr�s
zTestId.configurecCs�|��rg|_|jr<tttt|j���t|j������}n|j	}t
|jd�}t||j|j
d�|�|��t�d||j|j�dS)z&Save new ids file, if needed.
        �wb)r&rr(z#Saved test ids: %s, failed %s to %sN)�
wasSuccessfulr�
collecting�dict�list�zipr'�values�keysr&�openr#rr(�closerr)r�resultr&�fhrrr�finalize�s(zTestId.finalizec
st�d||�y�t|jd�}t|�}d|krL|d|_|d|_|d|_n||_g|_||_|jr�t|j�d|_	t
ttt|j�
��t|j������|_nd|_	t�d|j|j|j|j|j�|��WnZtk
�r}zt�d|jt|��Wd	d	}~XYn$tk
�r&t�d
|j�YnX|j�rJ|j�rJd|_|j}g|_g}g}g}x8|D]0}	|�|	�}
|
|	k�r�|�|
�n
|�|	��q\W|�r�t|�}t|j��t�d�|��fd
d�|D�}|�r�|j�|�|�s�|}nd|_t�d|||�d	||�p
|fS)zTranslate ids in the list of requested names into their
        test addresses, if they are found in my dict of tests.
        z
ltfn %s %s�rbr&rr(rz8Loaded test ids %s tests %s failed %s sources %s from %szError loading %s : %sNzIO error reading %sFzold: %s new: %scsg|]}|�kr|�qSrr)�.0�s)�old_setrr�
<listcomp>�sz-TestId.loadTestsFromNames.<locals>.<listcomp>z&translated: %s new sources %s names %s)rrr4r#rr&rr(�maxrr/r0r1r2r3r'r5�
ValueError�str�IOErrorrr.�tr�appendr�extend)r�names�moduler7�data�eZ
translatedZ
new_sourceZ
really_new�nameZtransZnew_setr)r<r�loadTestsFromNames�sb

*$




zTestId.loadTestsFromNamescCsDt�d|�|\}}}|dk	r(t|�}n|}|dk	r@d||fS|S)NzMake name %sz%s:%s)rrr)r�addr�filenamerF�call�headrrr�makeName�s

zTestId.makeNamecCs
||_dS)zBGet handle on output stream so the plugin can print id #s
        N)�stream)rrPrrr�setOutputStreamszTestId.setOutputStreamcCs�|��}t�d|||jk�||jkr^||jkr<|�d�n|�d|j|�d|j|<dS|j|j|<|�d|j�|jd7_dS)z�Maybe output an id # before the test name.

        Example output::

          #1 test.test ... ok
          #2 test.test_two ... ok

        zstart test %s (%s)z   z#%s rN)�addressrrr'r)�writer)r�testZadrrrr�	startTests	


zTestId.startTestcCsP|jdkrLyt|j|���}Wntk
r4YnX||jkrL|j�|�dS)NF)Zpassedr@r'rR�KeyErrorrrC)rrT�keyrrr�	afterTests

zTestId.afterTestcCs`t�d|�yt|�dd��}Wntk
r4|SXt�d|�||jkr\|�|j|�S|S)Nztr '%s'�#�z
Got key %s)rr�int�replacer?r&rO)rrIrWrrrrB(s
z	TestId.trcCs|jr|j�|�dS)N)r+rPrS)r�outputrrrrS5szTestId.write)N)�__name__�
__module__�__qualname__�__doc__rIr#r.rrrr8rJrOrQrUrXrBrSrrrrrns
H
r)raZ__test__�loggingr Znose.pluginsrZ	nose.utilrr�picklerr�ImportError�	getLoggerr^rrrrrr�<module>^s


Youez - 2016 - github.com/yon3zu
LinuXploit