Your IP : 216.73.216.213


Current Path : /opt/alt/python38/lib64/python3.8/distutils/tests/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/distutils/tests/__pycache__/test_file_util.cpython-38.pyc

U

i�f=�@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/python38/lib64/python3.8/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�W5|��Xt|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�close�writerr�assertEqualrr�mkdirr)r�fZwantedrrr�test_move_file_verbosity#s"
z)FileUtilTestCase.test_move_file_verbositycCsltdtdd�d��P|�t��:t|jd��}|�d�W5QRXt|j|jdd�W5QRXW5QRXdS)	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_renamecCs�tdttjd�d��ntdtdd�d��P|�t��:t|jd��}|�d�W5QRXt	|j|j
dd	�W5QRXW5QRXW5QRXdS)
Nr0r1r2z	os.unlinkr(r$r3rr&)rr4�errnoZEXDEVr5rr)rr+rrr6rrr�)test_move_file_exception_unpacking_unlinkGs��z:FileUtilTestCase.test_move_file_exception_unpacking_unlinkc
Cst|jd��}|�d�W5QRXzt�|j|j�Wn0tk
rf}z|�d|�W5d}~XYnXt|j�t�	|j�}t
|j|jdd�t�	|j�}t�	|j�}|�tj�
||�||f�|�tj�
||�||f�t|jd��}|�|��d�W5QRXdS)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�W5QRXt�|j�}tdtdd�d��t|j|jdd�W5QRXt�|j�}t�|j�}|�	tj
�||�||f�|�tj
�||�||f�|j|jfD]*}t|d	��}|�
|��d�W5QRXq�dS)
Nr$r%zos.linkrzlinking unsupportedr2r:r;r=)r)rr+rr>rr4rrr?rr@ZassertFalser,rA)rr.rCrDrE�fnrrr� test_copy_file_hard_link_failureds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