Your IP : 216.73.216.147


Current Path : /opt/alt/python39/lib64/python3.9/distutils/tests/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/distutils/tests/__pycache__/test_file_util.cpython-39.pyc

a

XC?h=�@s�dZddlZddlZddlZddlmZddlmZmZddl	m
Z
ddlmZddl
mZddlmZmZGd	d
�d
ejej�Zdd�Zed
kr�ee��dS)zTests for distutils.file_util.�N)�patch)�	move_file�	copy_file)�log)�support)�DistutilsFileError)�run_unittest�unlinkcsXeZdZdd�Z�fdd�Z�fdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
�ZS)�FileUtilTestCasecGs.t|�dkr|j�||�n|j�|�dS)Nr)�len�_logs�append)�self�msg�args�r�C/opt/alt/python39/lib64/python3.9/distutils/tests/test_file_util.py�_logszFileUtilTestCase._logcs`tt|���g|_tj|_|jt_|��}t	j
�|d�|_t	j
�|d�|_
t	j
�|d�|_dS)N�f1�f2Zd1)�superr
�setUprr�info�old_logrZmkdtemp�os�path�join�source�target�
target_dir)rZtmp_dir��	__class__rrrszFileUtilTestCase.setUpcs|jt_tt|���dS�N)rrrrr
�tearDown)rr rrr#szFileUtilTestCase.tearDowncCs�t|jd�}z|�d�W|��n
|��0t|j|jdd�g}|�|j|�t|j|jdd�t|j|jdd�d|j|jfg}|�|j|�t|j|jdd�g|_t�	|j
�t|j|j
dd�d|j|j
fg}|�|j|�dS)N�w�some contentr��verbose�zmoving %s -> %s)�openr�write�closerr�assertEqualrr�mkdirr)r�fZwantedrrr�test_move_file_verbosity#s"z)FileUtilTestCase.test_move_file_verbosityc
Cs�tdtdd�d���|�t��Xt|jd��}|�d�Wd�n1sL0Yt|j|jdd�Wd�n1s|0YWd�n1s�0YdS)	N�	os.rename�wrongr(�Zside_effectr$�	spam eggsrr&)	r�OSError�assertRaisesrr)rr*rr�rZfobjrrr�)test_move_file_exception_unpacking_rename?s�(z:FileUtilTestCase.test_move_file_exception_unpacking_renamecCs�tdttjd�d���tdtdd�d���|�t��Xt|jd��}|�d�Wd�n1sb0Yt	|j|j
dd	�Wd�n1s�0YWd�n1s�0YWd�n1s�0YdS)
Nr0r1r2z	os.unlinkr(r$r3rr&)rr4�errnoZEXDEVr5rr)rr*rrr6rrr�)test_move_file_exception_unpacking_unlinkGs��(z:FileUtilTestCase.test_move_file_exception_unpacking_unlinkc
Cs4t|jd��}|�d�Wd�n1s,0Yzt�|j|j�Wn2ty|}z|�d|�WYd}~nd}~00t|j�t�	|j�}t
|j|jdd�t�	|j�}t�	|j�}|�tj�
||�||f�|�tj�
||�||f�t|jd�� }|�|��d�Wd�n1�s&0YdS)Nr$r%zos.link: %s�hard��link�r)r)rr*rr<rr4ZskipTestr	�statr�
assertTruer�samestatr,�read)rr.�e�st�st2�st3rrr�test_copy_file_hard_linkPs($
z)FileUtilTestCase.test_copy_file_hard_linkc	Cs$t|jd��}|�d�Wd�n1s,0Yt�|j�}tdtdd�d��"t|j|jdd�Wd�n1s|0Yt�|j�}t�|j�}|�	tj
�||�||f�|�tj
�||�||f�|j|jfD]@}t|d	�� }|�
|��d�Wd�q�1�s0Yq�dS)
Nr$r%zos.linkrzlinking unsupportedr2r:r;r=)r)rr*rr>rr4rrr?rr@ZassertFalser,rA)rr.rCrDrE�fnrrr� test_copy_file_hard_link_failureds(0z1FileUtilTestCase.test_copy_file_hard_link_failure)�__name__�
__module__�__qualname__rrr#r/r7r9rFrH�
__classcell__rrr rr

s
	r
cCs
t�t�Sr")�unittestZ	makeSuiter
rrrr�
test_suitevsrN�__main__)�__doc__rMrr8Z
unittest.mockrZdistutils.file_utilrrZ	distutilsrZdistutils.testsrZdistutils.errorsrZtest.supportrr	ZTempdirManagerZTestCaser
rNrIrrrr�<module>si