Your IP : 216.73.216.85


Current Path : /opt/alt/python37/lib64/python3.7/distutils/tests/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/distutils/tests/__pycache__/test_build_py.cpython-37.opt-1.pyc

B

� f��@s�dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
Gdd	�d	ejejej�Zd
d�Zedkr�e
e��dS)
z%Tests for distutils.command.build_py.�N)�build_py)�Distribution)�DistutilsFileError)�support)�run_unittestc@sXeZdZdd�Zdd�Ze�ejd�dd��Z	e�ejd�dd	��Z
d
d�Zdd
�ZdS)�BuildPyTestCasec
Cs�|��}ttj�|d�d�}z|�d�Wd|��Xttj�|d�d�}z|�d�Wd|��X|��}tdgd|id��}tj�|d�|_t	j
d	|d
�|jd<dg|_ddgi|_
d|i|_t|�}d|_|��|�|j
|j
�|��|�t|���d
�tj�|d�}t�|�}tj�|d�}|�d|�|�d|�tj�r^|�tj�|��nt�|�}	|�dtjj|	�dS)Nz__init__.py�wz# Pretend this is a package.z
README.txtzInfo about this package�pkg)�packages�package_dirzsetup.pyr)Zforce�	build_lib�build���__pycache__z__init__.%s.pyc)�mkdtemp�open�os�path�join�write�closer�script_namerZDummyCommandZcommand_objr
�package_datarr�compileZensure_finalized�assertEqual�run�lenZget_outputs�listdir�assertIn�sys�dont_write_bytecodeZassertFalse�exists�implementation�	cache_tag)
�self�sources�fZdestination�dist�cmdZpkgdest�filesZpycache_dirZ	pyc_files�r+�B/opt/alt/python37/lib64/python3.7/distutils/tests/test_build_py.py�test_package_datasF




z!BuildPyTestCase.test_package_datacCs�|��}ttj�|d�d���tj�|d�}t�|�ttj�|d�d���t�|�tdgddiddgid��}tj�|d	�|_	d
g|_
|��y|��Wnt
k
r�|�d�YnXdS)Nz__init__.pyr�doc�testfiler	�zdoc/*)r
rrzsetup.pyr
z/failed package_data test when package_dir is '')rrrrrr�mkdir�chdirrr�script_args�parse_command_line�run_commandsr�fail)r%r&Ztestdirr(r+r+r,�test_empty_package_dirDs 

z&BuildPyTestCase.test_empty_package_dirzbyte-compile disabledcCs�|jdgd�\}}t�|�|�dd�t|�}d|_d|_|��|��t�	|j�}|�
t|�ddg�t�	tj�
|jd��}|�
|dtjjg�dS)	N�
boiledeggs)�
py_modulesz
boiledeggs.pyzimport antigravityr�hererzboiledeggs.%s.pyc)�create_distrr2�
write_filerrr�finalize_optionsrrr�sortedrrr r#r$)r%�project_dirr(r)�foundr+r+r,�test_byte_compile[s
z!BuildPyTestCase.test_byte_compilecCs�|jdgd�\}}t�|�|�dd�t|�}d|_d|_d|_|��|�	�t�
|j�}|�t|�ddg�t�
tj
�|jd��}d	�tjj�}|�t|�|g�dS)
Nr8)r9z
boiledeggs.pyzimport antigravityrrr:rzboiledeggs.{}.opt-1.pyc)r;rr2r<rr�optimizerr=rrrr>rr�formatr r#r$)r%r?r(r)r@Zexpectr+r+r,�test_byte_compile_optimizedls
z+BuildPyTestCase.test_byte_compile_optimizedcCs�|��}tj�|d�}t�|�ttj�|d�d���tj�|d�}t�|�ttj�|d�d���t�tj�|d��t�|�tdgddgid��}tj�|d	�|_	d
g|_
|��y|��Wnt
k
r�|�d�YnXdS)
zR
        A directory in package_data should not be added to the filelist.
        r	z__init__.pyrr.r/Zotherdirzdoc/*)r
rzsetup.pyr
z0failed package_data when data dir includes a dirN)rrrrr1rrr2rrr3r4r5rr6)r%r&Zpkg_dirZdocdirr(r+r+r,�test_dir_in_package_data~s$


z(BuildPyTestCase.test_dir_in_package_datacCsl|��d}t|�}d|_d|_tj}dt_z|�g�Wd|t_X|�d|jdd|jdd�dS)NrTzbyte-compiling is disabledr�)	r;rrrBr r!Zbyte_compilerZlogs)r%r(r)Zold_dont_write_bytecoder+r+r,�test_dont_write_bytecode�sz(BuildPyTestCase.test_dont_write_bytecodeN)
�__name__�
__module__�__qualname__r-r7�unittestZskipIfr r!rArDrErGr+r+r+r,rs1rcCs
t�t�S)N)rKZ	makeSuiterr+r+r+r,�
test_suite�srL�__main__)�__doc__rr rKZdistutils.command.build_pyrZdistutils.corerZdistutils.errorsrZdistutils.testsrZtest.supportrZTempdirManagerZLoggingSilencerZTestCaserrLrHr+r+r+r,�<module>s