Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/distutils/tests/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/distutils/tests/__pycache__/test_filelist.cpython-34.pyc

�
i fY'�@s�dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
ddlmZmZddlmZd	Zd
d�ZGdd
�d
ejej�Zdd�Zedkr�ee��ndS)zTests for distutils.filelist.�N)�debug)�WARN)�DistutilsTemplateError)�
glob_to_re�translate_pattern�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)z"Converts '/' in a string to os.sep�/)�replace�os�sep)�s�r�B/opt/alt/python34/lib64/python3.4/distutils/tests/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.assertWarningscCsotj}tjdkr-tjtj�}nx;dD]3\}}|i|d6}|jt|�|�q4WdS)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.r/r0)r
r�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|_x<tjd�D]+}|j�dkr�q�n|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_line?s8															z+FileListTestCase.test_process_template_linecCs�t�}t��}|jd�WdQX|j|j�d�dt_z9t��}|jd�WdQX|j|j�d�Wddt_XdS)NZxxxr7Tzxxx
F)rrZdebug_printr�getvaluer�DEBUG)rr>�stdoutrrr�test_debug_printgs		z!FileListTestCase.test_debug_printcCs<t�}dddg}|j|�|j|j|�dS)N�a�b�c)r�set_allfilesrr8)rr>r=rrr�test_set_allfilesus	
z"FileListTestCase.test_set_allfilescCs[t�}ddddddg|_|j�|j�|j|jddddg�dS)NrFrG�grH)rr=�sortZremove_duplicatesr)rr>rrr�test_remove_duplicates{s
	

z'FileListTestCase.test_remove_duplicatescCs�|jttddddd�d��tjd�}|jt|dddd�|�|jttddddd�d��|jtddddd�jd��dS)	NrFZanchorTZis_regexF�searchz*.pyzfilelist.py)�
assertTrue�hasattrrr1�compilerrN)rr3rrr�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=rOr)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�*)rrIrSZinclude_patternrOZassertIsNoner8r)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)	zincluderXrYrZr[r\r]r^r_)
rrZassertRaisesrr<rIrr=rr)rr?r>�actionrrr�test_process_template�s�	
		



	



	



	



	
%

%
	'



	
%

%
	'


z&FileListTestCase.test_process_templateN)�__name__�
__module__�__qualname__rrr4rArErJrMrRrTrVrarrrrr"s(rcCs
tjt�S)N)�unittestZ	makeSuiterrrrr�
test_suite'srf�__main__)�__doc__r
r1reZ	distutilsrZ
distutils.logrZdistutils.errorsrZdistutils.filelistrrrZtest.supportrr	Zdistutils.testsr
r9rZLoggingSilencerZTestCaserrfrbrrrr�<module>s"�