Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/distutils/tests/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/distutils/tests/__pycache__/test_filelist.cpython-35.opt-2.pyc



���]�,�@s%ddlZddlZddlZddlmZddlmZddlmZddl	m
Z
mZmZddlm
Z
ddlZddlmZmZddlmZd	Zd
d�ZGdd
�d
ejej�ZGdd�dej�Zdd�Zedkr!ee��dS)�N)�debug)�WARN)�DistutilsTemplateError)�
glob_to_re�translate_pattern�FileList)�filelist)�captured_stdout�run_unittest)�supportz�include ok
include xo
exclude xo
include foo.tmp
include buildout.cfg
global-include *.x
global-include *.txt
global-exclude *.tmp
recursive-include f *.oo
recursive-exclude global *.x
graft dir
prune dir3
cCs|jdtj�S)N�/)�replace�os�sep)�s�r�2/opt/alt/python35/lib64/python3.5/test_filelist.py�make_local_pathsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�FileListTestCasecCs'|j|jt�g�|j�dS)N)�assertEqual�get_logsr�
clear_logs)�selfrrr�assertNoWarnings'sz!FileListTestCase.assertNoWarningscCs-|jt|jt��d�|j�dS)Nr)Z
assertGreater�lenrrr)rrrr�assertWarnings+szFileListTestCase.assertWarningscCsktj}tjdkr*tjtj�}x:dD]2\}}|d|i}|jt|�|�q1WdS)N�\�foo*�foo[^%(sep)s]*\Z(?ms)�foo?�foo[^%(sep)s]\Z(?ms)�foo??�foo[^%(sep)s][^%(sep)s]\Z(?ms)�foo\\*�foo\\\\[^%(sep)s]*\Z(?ms)�foo\\\*�foo\\\\\\[^%(sep)s]*\Z(?ms)�foo????�2foo[^%(sep)s][^%(sep)s][^%(sep)s][^%(sep)s]\Z(?ms)�foo\\??�"foo\\\\[^%(sep)s][^%(sep)s]\Z(?ms)r�rr�rr �r!r"�r#r$�r%r&�r'r(�r)r*)r+r,r-r.r/r0r1)rr�re�escaperr)rrZglob�regexrrr�test_glob_to_re/s	z FileListTestCase.test_glob_to_recCst�}t}ddddd|d�|d�|d�|d	�|d
�|d�|d�|d
�|d�|d�g|_x9tjd�D](}|j�dkr�q�|j|�q�Wddd|d�|d�|d�|d�|d�|d
�g	}|j|j|�dS)Nzfoo.tmp�okZxozfour.txtzbuildout.cfgz.hg/last-message.txtzglobal/one.txtzglobal/two.txtzglobal/files.xzglobal/here.tmpzf/o/f.ooz
dir/graft-onezdir/dir2/graft2zdir3/okzdir3/sub/ok.txt�
�)	rr�allfiles�MANIFEST_IN�split�strip�process_template_liner�files)r�	file_list�l�lineZwantedrrr�test_process_template_lineAs8															z+FileListTestCase.test_process_template_linecCs�t�}t��}|jd�WdQRX|j|j�d�dt_z:t��}|jd�WdQRX|j|j�d�Wddt_XdS)NZxxxr8Tzxxx
F)rr	Zdebug_printr�getvaluer�DEBUG)rr?�stdoutrrr�test_debug_printis		z!FileListTestCase.test_debug_printcCs<t�}dddg}|j|�|j|j|�dS)N�a�b�c)r�set_allfilesrr9)rr?r>rrr�test_set_allfilesws	
z"FileListTestCase.test_set_allfilescCs[t�}ddddddg|_|j�|j�|j|jddddg�dS)NrGrH�grI)rr>�sortZremove_duplicatesr)rr?rrr�test_remove_duplicates}s
	

z'FileListTestCase.test_remove_duplicatescCs�|jttddddd�d��tjd�}|jt|dddd�|�|jttddddd�d��|jtddddd�jd��dS)	NrGZanchorTZis_regexF�searchz*.pyzfilelist.py)�
assertTrue�hasattrrr2�compilerrO)rr4rrr�test_translate_pattern�s	
	
	z'FileListTestCase.test_translate_patterncCs�t�}|j|jd��t�}ddg|_|j|jd��t�}ddg|_|jd�|j|jdg�dS)Nz*.pyza.pyzb.pyza.txt)r�assertFalseZexclude_patternr>rPr)rr?rrr�test_exclude_pattern�s			
z%FileListTestCase.test_exclude_patterncCs�t�}|jg�|j|jd��t�}|jddg�|j|jd��t�}|j|j�|jddg�|jd�|j|jddg�dS)Nz*.pyza.pyzb.txt�*)rrJrTZinclude_patternrPZassertIsNoner9r)rr?rrr�test_include_pattern�s	
		
z%FileListTestCase.test_include_patternc	Cs�t}t�}x$d!D]}|jt|j|�qWt�}|jd
d|d�g�|jd
�|j|jd
g�|j�|jd�|j|jd
g�|j	�t�}d
d|d�g|_|jd�|j|jd|d�g�|j�|jd�|j|jd|d�g�|j	�t�}|jd
d|d�g�|jd�|j|jd
|d�g�|j�|jd�|j|jd
|d�g�|j	�t�}d
d|d�g|_|jd�|j|jdg�|j�|jd�|j|jdg�|j	�t�}|jd
|d�|d�|d�g�|jd�|j|j|d�|d�g�|j�|jd�|j|j|d�|d�g�|j	�t�}d
|d�|d�|d�g|_|jd�|j|jd
|d�g�|j�|jd�|j|jd
|d�g�|j	�t�}|jd
|d�|d�|d�g�|jd�|j|j|d�|d�g�|j�|jd�|j|j|d�|d�g�|j	�t�}d
|d�|d�|d�g|_|jd�|j|jd
|d�g�|j�|jd �|j|jd
|d�g�|j	�dS)"N�include�exclude�global-include�global-exclude�recursive-include�recursive-exclude�graft�prune�blargza.pyzb.txtzd/c.pyzinclude *.pyzinclude *.rbzexclude *.pyzexclude *.rbzglobal-include *.pyzglobal-include *.rbzglobal-exclude *.pyzglobal-exclude *.rbzd/b.pyzd/c.txtzd/d/e.pyzrecursive-include d *.pyzrecursive-include e *.pyzrecursive-exclude d *.pyzrecursive-exclude e *.pyzf/f.pyzgraft dzgraft ezprune dzprune e)	rXrYrZr[r\r]r^r_r`)
rrZassertRaisesrr=rJrr>rr)rr@r?�actionrrr�test_process_template�s�	
		



	



	



	



	
%

%
	'



	
%

%
	'


z&FileListTestCase.test_process_templateN)�__name__�
__module__�__qualname__rrr5rBrFrKrNrSrUrWrbrrrrr$s(rc@s@eZdZejjdd��Zdd�Zdd�ZdS)�FindAllTestCasec
CsAtjj��+tjdd�|jtj�g�WdQRXdS)N�foo�bar)�testr�temp_cwdr�symlinkrr�findall)rrrr�test_missing_symlink*sz$FindAllTestCase.test_missing_symlinkc
Cs�tjj���tjd�tjjdd�}tjj|�tjd�tjjdd�}tjj|�||g}|jt	t
j��|�WdQRXdS)Nrgz	file1.txtrhz	file2.txt)rirrjr�mkdir�path�join�create_empty_filer�sortedrrl)r�file1Zfile2�expectedrrr�test_basic_discovery0s

z$FindAllTestCase.test_basic_discoveryc
Csdtjj��N}tjj|d�}tjj|�|g}|jtj	|�|�WdQRXdS)Nz	file1.txt)
rir�temp_dirrrorprqrrrl)rrvrsrtrrr�test_non_local_discovery@s
	z(FindAllTestCase.test_non_local_discoveryN)	rcrdrerirZskip_unless_symlinkrmrurwrrrrrf)srfcCs%tjtjt�tjt�g�S)N)�unittestZ	TestSuiteZ	makeSuiterrfrrrr�
test_suiteLsry�__main__)rr2rxZ	distutilsrZ
distutils.logrZdistutils.errorsrZdistutils.filelistrrrrZtest.supportrir	r
Zdistutils.testsrr:rZLoggingSilencerZTestCaserrfryrcrrrr�<module>s&�#