403 Forbidden


Disable Functions:
Path : /lib64/python2.7/site-packages/psutil/tests/
File Upload :
Command :
Current File : //lib64/python2.7/site-packages/psutil/tests/test_unicode.pyo

�
S��]c
@s�dZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lm
Z
dd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%dd lm&Z&ddlZd!�Zd"�Z'e
rPe"j(d#�d$j)d#d%�Z*n
e"d$Z*d&e+fd'��YZ,e%j-eoe$d(�e%j-eo�e$d)�e%j-ed*�e%j-e'e#�d+�d,e,e%j.fd-��Y����Z/e%j-eo�e$d(�e%j-eoe$d)�e%j-e'e*�d.�d/e,e%j.fd0��Y���Z0e%j-ed1�d2e%j.fd3��Y�Z1d4e%j.fd5��YZ2e3d6kr�dd7l4m5Z5e5e6�ndS(8s�
Notes about unicode handling in psutil
======================================

In psutil these are the APIs returning or dealing with a string
('not tested' means they are not tested to deal with non-ASCII strings):

* Process.cmdline()
* Process.connections('unix')
* Process.cwd()
* Process.environ()
* Process.exe()
* Process.memory_maps()
* Process.name()
* Process.open_files()
* Process.username()             (not tested)

* disk_io_counters()             (not tested)
* disk_partitions()              (not tested)
* disk_usage(str)
* net_connections('unix')
* net_if_addrs()                 (not tested)
* net_if_stats()                 (not tested)
* net_io_counters()              (not tested)
* sensors_fans()                 (not tested)
* sensors_temperatures()         (not tested)
* users()                        (not tested)

* WindowsService.binpath()       (not tested)
* WindowsService.description()   (not tested)
* WindowsService.display_name()  (not tested)
* WindowsService.name()          (not tested)
* WindowsService.status()        (not tested)
* WindowsService.username()      (not tested)

In here we create a unicode path with a funky non-ASCII name and (where
possible) make psutil return it back (e.g. on name(), exe(), open_files(),
etc.) and make sure that:

* psutil never crashes with UnicodeDecodeError
* the returned path matches

For a detailed explanation of how psutil handles unicode see:
- https://github.com/giampaolo/psutil/issues/1040
- http://psutil.readthedocs.io/#unicode
i����N(tclosing(tBSD(tMACOS(tOPENBSD(tPOSIX(tWINDOWS(tPY3(tu(tAPPVEYOR(tASCII_FS(tbind_unix_socket(tchdir(tcopyload_shared_lib(t
create_exe(tget_test_subprocess(tHAS_CONNECTIONS_UNIX(tHAS_ENVIRON(tHAS_MEMORY_MAPS(tmock(tPYPY(t
reap_children(t
safe_mkdir(tsafe_rmpath(tskip_on_access_denied(tTESTFILE_PREFIX(tTESTFN(tTESTFN_UNICODE(tTRAVIS(tunittest(tunix_socket_pathcCsCtr5yt|�SWq?tk
r1tj�q?Xn
t|�SdS(N(Rt_safe_rmpathtWindowsErrort	tracebackt	print_exc(tpath((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyR\s
cCs^tr
tSzEy(t|�t|�td|g�Wntk
rItSXtSWdt�XdS(s`Return True if both the fs and the subprocess module can
    deal with a unicode file name.
    tcmdN(RtTrueRR
RtUnicodeEncodeErrortFalseR(tname((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pytsubprocess_supports_unicodeps


tutf8sf��tsurrogateescapet_BaseFSAPIsTestscBs�eZdZed��Zed��Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
ejed	�d
��Zejed	�ejed�e�d����Zd
�Zejed�ejed�d���ZRS(cCst|j�t|j�dS(N(Rt
funky_nameR
(tcls((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyt
setUpClass�s
cCst�t|j�dS(N(RRR,(R-((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyt
tearDownClass�scCst�dS(N(R(tself((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyttearDown�scCstd��dS(Nsmust be implemented in subclass(tNotImplementedError(R0((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pytexpect_exact_path_match�scCsitd|jg�}tj|j�}|j�}|j|t�|j�re|j	||j�ndS(NR#(
RR,tpsutiltProcesstpidtexetassertIsInstancetstrR3tassertEqual(R0tsubptpR7((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyt
test_proc_exe�scCs�td|jg�}trctjddtjtj����}tj	|j
�j�}WdQXntj	|j
�j�}|j|t
�|j�r�|j|tjj|j��ndS(NR#s psutil._psplatform.cext.proc_exetside_effect(RR,RRtpatchR4tAccessDeniedtostgetpidR5R6R'R8R9R3R:R"tbasename(R0R;tmR'((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyttest_proc_name�s	cCs}td|jg�}tj|j�}|j�}x|D]}|j|t�q:W|j�ry|j	||jg�ndS(NR#(
RR,R4R5R6tcmdlineR8R9R3R:(R0R;R<RFtpart((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyttest_proc_cmdline�s
cCs�|jd}|jt|�t|�t|��tj�}|j�}WdQX|j|j�t	�|j
�r�|j||�ndS(Nt2(R,t
addCleanupRRRR4R5tcwdR8R9R3R:(R0tdnameR<RK((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyt
test_proc_cwd�s


cCs�tj�}t|j��}t|jd��t|j��}WdQX||j�j}|j|t	�t
r�|r�|jd�S|j�r�|j
tjj|�tjj|j��ndS(Ntrbsopen_files on BSD is broken(R4R5tsett
open_filestopenR,tpopR"R8R9RtskipTestR3R:RAtnormcase(R0R<tstarttnewR"((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyttest_proc_open_files�s

s
POSIX onlycCs�tjj|j�}td|���}yt|�}Wn,tk
retrS�qftj	d��nXt
|��Mtj�j
d�d}|j|jt�ts�|j|j|�nWdQXWdQXdS(Ntsuffixs
not supportedtunixi(RAR"RCR,RR
R%RRtSkipTestRR4R5tconnectionsR8tladdrR9RR:(R0RXR'tsocktconn((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyttest_proc_connections�s

scan't list UNIX socketscCs�d�}tjj|j�}td|���}yt|�}Wn,tk
rntr\�qotj	d��nXt
|��Rtjdd�}t
s�||�}|j|jt�|j|j|�nWdQXWdQXdS(NcSsCx0|D](}tjj|j�jt�r|SqWtd��dS(Nsconnection not found(RAR"RCR\t
startswithRt
ValueError(tconsR^((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyt	find_sock�s
RXs
not supportedtkindRY(RAR"RCR,RR
R%RRRZRR4tnet_connectionsRR8R\R9R:(R0RcRXR'R]RbR^((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyttest_net_connections�s	

cCs8|jd}|jt|�t|�tj|�dS(NRI(R,RJRRR4t
disk_usage(R0RL((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyttest_disk_usage	s

s
not supporteds&ctypes does not support unicode on PY2cCs�td|j���}d�}gtj�j�D]}||j�^q1}g|D]}t|krS|^qS}|j||�|�x|D]}|j|t	�q�WWdQXdS(Nt
dst_prefixcSstjjtjj|��S(N(RAR"trealpathRT(R<((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pytnormpaths(
RR,R4R5tmemory_mapsR"RtassertInR8R9(R0t
funky_pathRktxtlibpathsR"((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyttest_memory_mapss	+%
N(t__name__t
__module__tNoneR,tclassmethodR.R/R1R3R=RERHRMRWRtskipIfRR_RRRfRhRRRq(((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyR+�s"									sunreliable on PYPY + TRAVISsunreliable on TRAVISsASCII fss"subprocess can't deal with unicodet
TestFSAPIscBs#eZdZeZed��ZRS(s1Test FS APIs with a funky, valid, UTF8 path name.cCshtr
tSt|jt�r"dn	td�}tj��(tjd�|jt	j
|�kSWdQXdS(Nt.tignore(RR$t
isinstanceR,R9Rtwarningstcatch_warningstsimplefilterRAtlistdir(R-there((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyR3*s$

(RrRst__doc__RR,RuR3(((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyRw!ss*subprocess can't deal with invalid unicodetTestFSAPIsWithInvalidPathcBs#eZdZeZed��ZRS(s-Test FS APIs with a funky, invalid path name.cCstS(N(R$(R-((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyR3?s(RrRsR�tINVALID_NAMER,RuR3(((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyR�7ssWINDOWS onlytTestWinProcessNamecBseZd�ZRS(cCsMtjddtjtj����#}|jtj�j�t	�WdQXdS(Ns psutil._psplatform.cext.proc_exeR>(
RR?R4R@RARBR8R5R'R9(R0RD((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyttest_name_typeHs(RrRsR�(((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyR�Est
TestNonFSAPIScBs3eZdZd�Zejed�d��ZRS(s&Unicode tests for non fs-related APIs.cCst�dS(N(R(R0((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyR1Zss
not supportedcCs�tjj�}trtnd}||d<td|�}tj|j�}|j�}x:|j	�D],\}}|j
|t�|j
|t�qeW|j|d|�dS(Nsèt	FUNNY_ARGtenv(
RAtenvirontcopyRRRR4R5R6titemsR8R9R:(R0R�t	funky_strtsprocR<tktv((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyttest_proc_environ]s
(RrRsR�R1RRvRR�(((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyR�Ws	t__main__(trun(7R�RAR R{t
contextlibRR4RRRRRtpsutil._compatRRtpsutil.testsRR	R
RRR
RRRRRRRRRRRRRRRRRR(tencodetdecodeR�tobjectR+RvtTestCaseRwR�R�R�Rrtpsutil.tests.runnerR�t__file__(((s?/usr/lib64/python2.7/site-packages/psutil/tests/test_unicode.pyt<module>5st		
�	%	"


404 Not Found
[ LogOut ]