Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/__pycache__/test_platform.cpython-34.pyo

�
g f}0�@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddlm	Z	Gdd�dej
�Zdd�Ze
dkr�e�ndS)	�)�mockN)�supportc@sreZdZdd�Zejdd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zejejjd�d�dd ��Zd!d"�Zd#d$�Zd%d&�Zejejd'kd(�d)d*��Zd+d,�Zd-d.�Zd/d0�Zd1d2�Z d3d4�Z!d5S)6�PlatformTestcCstj�}dS)N)�platformZarchitecture)�self�res�r�7/opt/alt/python34/lib64/python3.4/test/test_platform.py�test_architecture
szPlatformTest.test_architecturecCs�tjdkrAdjtjjtj�tjd�tjd<ndd�}tjjtj�}tjj	t
j�}tj||�z |j
||�||��Wdtj|�XdS)N�win32z{};{}ZPathcSs1|ddg}tj|dtj�}|j�S)Nz-cz/import platform; print(platform.architecture())�stdout)�
subprocess�Popen�PIPEZcommunicate)�python�cmd�prrr	�gets	z7PlatformTest.test_architecture_via_symlink.<locals>.get)�sysr�format�os�path�dirname�
executable�environ�realpath�abspathrZTESTFN�symlink�assertEqual�remove)rr�real�linkrrr	�test_architecture_via_symlinks, z*PlatformTest.test_architecture_via_symlinkcCs8x1dD])}x dD]}tj||�}qWqWdS)NFT)FT)FT)r)rZaliasedZterserrrr	�
test_platform%s

zPlatformTest.test_platformcCstj�}dS)N)r�system)rrrrr	�test_system*szPlatformTest.test_systemcCstj�}dS)N)r�node)rrrrr	�	test_node-szPlatformTest.test_nodecCstj�}dS)N)r�release)rrrrr	�test_release0szPlatformTest.test_releasecCstj�}dS)N)r�version)rrrrr	�test_version3szPlatformTest.test_versioncCstj�}dS)N)r�machine)rrrrr	�test_machine6szPlatformTest.test_machinecCstj�}dS)N)r�	processor)rrrrr	�test_processor9szPlatformTest.test_processorcCs(tj|_tj|_tj|_dS)N)rr*�save_version�
_mercurial�save_mercurialr�
save_platform)rrrr	�setUp<szPlatformTest.setUpcCs(|jt_|jt_|jt_dS)N)r0rr*r2r1r3r)rrrr	�tearDownAszPlatformTest.tearDownc
Cs�x]d7D]U\}}tj|�\}}}}}}}	|j||dd|||	f|�qWid9dd:|jf6d<d=6d?d@6dBdC6dEdG6dId)dJ|jf6}
x|
j�D]\\}}}
}|t_|dkr�ttd*�rt`qn	|t_|
dk	r|
t_n|jtj	�|d+�|jtj
�|d,�|jtj�|d-�|jtj�|d.�|jtj
�|d/�|jtj�|d0�q�WdS)KN�C2.4.3 (#1, Jun 21 2006, 13:54:21) 
[GCC 3.3.4 (pre 3.3.5 20040809)]�CPython�2.4.3��1�Jun 21 2006 13:54:21�GCC 3.3.4 (pre 3.3.5 20040809)�)IronPython 1.0.60816 on .NET 2.0.50727.42�
IronPython�	1.0.60816�.NET 2.0.50727.42�4IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42�1.0.0�2.6.1�	tags/r261�67515�
r261:67515�Dec  6 2008 15:26:00�+GCC 4.0.1 (Apple Computer, Inc. build 5370)zX2.6.1 (r261:67515, Dec  6 2008, 15:26:00) 
[GCC 4.0.1 (Apple Computer, Inc. build 5370)]�2.0.0�.NET 2.0.50727.3053�/IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3053�cli�.NET 2.0.50727.1433�=2.6.1 (IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433)�2.7.4�Mono 4.0.30319.1 (32-bit)�@2.7.4 (IronPython 2.7.4 (2.7.0.40) on Mono 4.0.30319.1 (32-bit))�Jython�2.5.0�trunk�6107�
trunk:6107�Mar 26 2009�java1.5.0_16�^2.5 (trunk:6107, Mar 26 2009, 13:02:18) 
[Java HotSpot(TM) Client VM ("Apple Computer, Inc.")]�PyPy�2.5.2�63378z12.5.2 (63378, Mar 26 2009, 18:03:29)
[PyPy 1.0.0]r1r������r7r8r9r9r:r;r<�r6rb�r>r?r9r9r9r9r@�r=rd�r>rBr9r9r9r9r@�rArf)rcrerg�rFrG)r7rCrDrErhrH)r7rDrE�r9r9)r>rIr9r9rirJ)rKNrL�r9r9)r>rCr9r9rjrM)rNNrL�r9r9)r>rOr9r9rkrP)rQNrL�rVrW)rRrSrTrUrlrX�rRrTrU)rYrmrX�r\rW)rZr[rTr\rnr9)rZrTr\)rZ_sys_versionrr3�itemsrr*�hasattrr1Zpython_implementationZpython_versionZ
python_branchZpython_revisionZpython_buildZpython_compiler)r�input�output�namer*�branchZrevisionZbuildnoZ	builddateZcompilerZsys_versionsZversion_tagZ
subversionZsys_platform�inforrr	�test_sys_versionFsN$#		zPlatformTest.test_sys_versioncCs+tjtj�tj�tj��}dS)N)rZsystem_aliasr$r(r*)rrrrr	�test_system_alias�s		zPlatformTest.test_system_aliascCs�tj�}|jt|��|j|d|j�|j|d|j�|j|d|j�|j|d|j�|j|d|j	�|j|d|j
�dS)Nrr]r^r_r`ra)r�uname�
assertTrue�anyrr$r&r(r*r,r.)rrrrr	�
test_uname�szPlatformTest.test_uname�winzwindows only testcCs�z�tj���}d|kr(|d=nd|d<dt_tj�\}}}}}}|j|d�d|d<dt_tj�\}}}}}}|j|d�WdQXWddt_XdS)NZPROCESSOR_ARCHITEW6432ZfooZPROCESSOR_ARCHITECTUREZbar)rZEnvironmentVarGuardrZ_uname_cacherxr)rrr$r&r(r*r,r.rrr	�test_uname_win32_ARCHITEW6432�s

	
	z*PlatformTest.test_uname_win32_ARCHITEW6432cCs5tj�}tjdkr1|jt|��ndS)N�java)rZjava_verrry�all)rrrrr	�
test_java_ver�szPlatformTest.test_java_vercCstj�}dS)N)rZ	win32_ver)rrrrr	�test_win32_ver�szPlatformTest.test_win32_vercCsPtj�}tj�jdkrLtjdd�}d}x7|D]/}|jd�r@|j�j�d}Pq@q@W|j	�|j
|dk�|djd�}|jd�}t|�t|�}|dkr�|jdg|�n|j
||�|j
|dd�tjd
kr5|j|dd�qL|j
|dd�ndS)NZDarwinZsw_vers�rzProductVersion:r]r�.�0r9�littler^�i386�x86_64ZPowerPC���)r9r9r9)r�r�)r�mac_verrxr$r�popen�
startswith�strip�split�closeZassertFalse�len�extendrr�	byteorderZassertIn)rr�fdZreal_ver�lnZresult_listZexpect_listZlen_diffrrr	�test_mac_ver�s(

zPlatformTest.test_mac_ver�darwinz
OSX only testcCsptj�}|dkr4tj�}tjd�n8tj|d�\}}|j||�|j|d�dS)Nr)r�forkrr��_exit�waitpidr)r�pidruZcpid�stsrrr	�test_mac_ver_with_fork�sz#PlatformTest.test_mac_ver_with_forkcCstj�}dS)N)rZdist)rrrrr	�	test_dist�szPlatformTest.test_distcCsfddl}|jjtj�rJ|jjtjd�rJtjd}n	tj}tj|�}dS)Nrz.exe)rr�isdirrr�existsrZlibc_ver)rrrrrrr	�
test_libc_ver�s	zPlatformTest.test_libc_verc
Cs4x-d5D]%\}}|jtj|�|�qWdS)6N�SuSE Linux 9.3 (x86-64)�SuSE Linux �9.3�x86-64�SUSE LINUX 10.1 (X86-64)�SUSE LINUX �10.1�X86-64�SUSE LINUX 10.1 (i586)�i586� Fedora Core release 5 (Bordeaux)�Fedora Core�5�Bordeaux�"Red Hat Linux release 8.0 (Psyche)�
Red Hat Linux�8.0�Psyche� Red Hat Linux release 9 (Shrike)�9�Shrike�+Red Hat Enterprise Linux release 4 (Nahant)�Red Hat Enterprise Linux�4�Nahant�CentOS release 4�CentOS�Rocks release 4.2.1 (Cydonia)�Rocks�4.2.1�Cydoniar9�r�r�r��r�r��r�r�r��r�r��r�r�r��r�r��r�r�r��r�r��r�r�r��r�r��r�r�r��r�r��r�r�r��r�r��r�r�N�r�r��r�r�r��r�r��r9r9r9�r9r�)
r�r�r�r�r�r�r�r�r�r�)rrZ_parse_release_file)rrqrrrrr	�test_parse_release_file�sz$PlatformTest.test_parse_release_filec	Csrtjdk}|r*djtj�}ndjtj�}tj��Ytjdt�tj|��3}|j	�j
�}|j�|j|d�WdQXWdQXd}|r�d}nd}|jtj�}tj���tjdt�tj|d	��g}|j
|�}|j�}|j|�tjd
krB|}n
|d?}|j|t|��WdQXWdQXdS)Nrz"{}" -c "print('Hello')"z'{}' -c 'print("Hello")'�ignoreZHelloZplopz<"{}" -c "import sys; data=sys.stdin.read(); exit(len(data))"z<'{}' -c 'import sys; data=sys.stdin.read(); exit(len(data))'�w�nt�)rrrr�warnings�catch_warnings�simplefilter�DeprecationWarningr��readr�r�r�writeZassertIsNotNonerrsr�)	rZ	mswindowsZcommandrZhello�data�stdinZret�
returncoderrr	�
test_popens2

	

	
zPlatformTest.test_popencCs�tj���}tjj|d�}t|ddd��}|jd�WdQXtjd|��t	j
�\}}}WdQX|j|d�|j|d�|j|d	�WdQXdS)
Nzfedora-releaser��encodingzutf-8u)Fedora release 19 (Schrödinger’s Cat)
zplatform._UNIXCONFDIRZFedoraZ19uSchrödinger’s Cat)�tempfileZTemporaryDirectoryrr�join�openr�rZpatchrZlinux_distributionr)rZtempdir�filename�fZdistnamer*Zdistidrrr	� test_linux_distribution_encoding,sz-PlatformTest.test_linux_distribution_encodingN)"�__name__�
__module__�__qualname__r
rZskip_unless_symlinkr"r#r%r'r)r+r-r/r4r5rvrwr{�unittestZ
skipUnlessrrr�r}r�r�r�r�r�r�r�r�r�rrrr	rs0G
*!'
 rcCstjt�dS)N)rZrun_unittestrrrrr	�	test_main:sr��__main__)r�rrrr
rr�r�ZtestrZTestCaserr�r�rrrr	�<module>s�/