Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 13.58.254.160
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_site.pyo
�
?��cc@sndZddlZddlmZmZmZddlmZddlmZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZdejkr�ddlZnejd��ead	�Zd
�Zdejfd��YZd
efd��YZdejfd��YZd�Zedkrje�ndS(sTests for 'site'.

Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.

i����N(trun_unittesttTESTFNtEnvironmentVarGuard(tcaptured_output(tsupport(tcopytsites!importation of site.py suppressedcCs�tjatjr�tjjtj�r�y$tjtj�tj	tj�Wq�t
k
r�}|jtjtj
fkr�tjdtj|f��q��q�XndS(Ns-unable to create user site directory (%r): %s(tsystpathtOLD_SYS_PATHRtENABLE_USER_SITEtostisdirt	USER_SITEtmakedirst
addsitedirtOSErrorterrnotEACCEStEPERMtunittesttSkipTest(texc((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pytsetUpModule!s
	cCsttj(dS(N(R	RR(((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttearDownModule3stHelperFunctionsTestscBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zde	d�Z
d	�Zd
�Ze
jejdkd�d
��Zd�Ze
jejd�d��Zd�Zd�Zd�Zd�ZRS(s�Tests for helper functions.

    The setting of the encoding (set using sys.setdefaultencoding) used by
    the Unicode implementation is not tested.

    cCsGtj|_tj|_tj|_tj|_	t
tj�|_
dS(sSave a copy of sys.pathN(RRtsys_pathRt	USER_BASEtold_baseR
told_sitetPREFIXEStold_prefixesRt	sysconfigt_CONFIG_VARStold_vars(tself((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pytsetUp?s

cCsA|jtj(|jt_|jt_|jt_	|j
t_dS(sRestore sys.pathN(
RRRRRRRR
RRR"R R!(R#((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttearDownGs

cCs�d}tjj|�}tj|�\}}|jtjj|�|�|tjj|�krt|j||�n|jtjj|�|�dS(Nt	BeginningtEnd(R&R'(RRtjoinRtmakepathtassertEqualtabspathtnormcase(R#t
path_partstoriginal_dirtabs_dirtnorm_dir((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyt
test_makepathOscCsytj�}xfgtjD]1}|rtjj|�rtj|�d^qD]#}|j||d||f�qNWdS(NisB%s from sys.path not found in set returned by _init_pathinfo(): %s(Rt_init_pathinfoRRRRR)tassertIn(R#tdir_setRtentry((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_init_pathinfo\s5cCsc|j|jtjd|j�|jtj|j�dtj�|jt	jj
|j��dS(s>Contain common code for testing results of reading a .pth files%s not in sys.modulesiN(R3timportedRtmodulesRR)t
good_dir_pathRtassertFalseRtexiststbad_dir_path(R#tpth_file((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pytpth_file_testsds#cCsbt�}|jdt�z7|j�tj|j|jt��|j	|�Wd|j�XdS(Ntprep(
tPthFiletcleanuptTruetcreateRt
addpackagetbase_dirtfilenametsetR>(R#R=((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_addpackageks	
t.cswtjj|�}|d}tjj||��t�d�}|j�fd��|j|�|j�||fS(Ns.pthtwcs
tj��S(N(Rtremove((tpth_fn(s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyt<lambda>�t(RRR+R(topent
addCleanuptwritetclose(R#tcontentstpth_dirtpth_nametpth_basenameR=((RLs5/usr/local/python-2.7/lib/python2.7/test/test_site.pytmake_pthzs


cCs�|jd�\}}td��}tj||t��WdQX|j|j�d�|j|j�tjt	j
j||���|j|j�d�|j|j�d�|j|j�d�dS(Nsimport bad)syntax
tstderrsline 1t	Tracebacksimport bad\)syntaxtSyntaxError(RWRRRDRGtassertRegexpMatchestgetvaluetretescapeRRR((R#RTRLterr_out((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyt!test_addpackage_import_bad_syntax�scCs�|jd�\}}td��}tj||t��WdQX|j|j�d�|j|j�tjt	j
j||���|j|j�d�|j|j�d�dS(Nsrandompath
import nosuchmodule
RXsline 2RYtImportError(RWRRRDRGR[R\R]R^RRR((R#RTRLR_((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_addpackage_import_bad_exec�stwin32sIWindows does not raise an error for file paths containing null characterscCs�|jd�\}}td��}tj||t��WdQX|j|j�d�|j|j�tjt	j
j||���|j|j�d�|j|j�d�dS(Nsabcdef
RXsline 1RYt	TypeError(RWRRRDRGR[R\R]R^RRR((R#RTRLR_((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyt#test_addpackage_import_bad_pth_file�scCs\t�}|jdt�z1|j�tj|jt��|j|�Wd|j�XdS(NR?(	R@RARBRCRRRERGR>(R#R=((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_addsitedir�s	
s<requires access to PEP 370 user-site (site.ENABLE_USER_SITE)cCsPtj}|j|tj�tjj�}tj	tj
dd|gd|�}|j|dd||f�tjj�}tj	tj
ddd|gd|�}|j|d�tjj�}d|d	<tj	tj
dd|gd|�}|j|d�tjj�}d
|d<tj	tj
ddgd|�}|j|d�dS(
Ns-cs$import sys; sys.exit(%r in sys.path)tenvis,%r is not in sys.path (sys.exit returned %r)s-sit1tPYTHONNOUSERSITEs/tmptPYTHONUSERBASEs=import sys, site; sys.exit(site.USER_BASE.startswith("/tmp"))(RR
R3RRRtenvironRt
subprocesstcallt
executableR*(R#tusersiteRgtrc((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyt
test_s_option�s2	
	
	

	
		cCs�dt_tj�}|jtj|�dt_ddl}d|_t��6}d|d<|jtj�j	d�tj��WdQXdS(Ni����txoxoRj(
tNoneRRtgetuserbaseR*R R!Rt
assertTruet
startswith(R#t	user_baseR Rk((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_getuserbase�s			
cCsjdt_dt_tj�}|jtj|�|j|jtj�|�|jtjtj��dS(N(	RsRR
RtgetusersitepackagesR*RuRvRt(R#t	user_site((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_getusersitepackages�s		cCsTdgt_tj�}tjdkrl|jt|�d�tjj	ddd�}|j|d|�n�tj
dkr�|jt|�d	�tjj	dd
dtjd d�}|j|d|�tjj	dd
d
�}|j|d|�nV|jt|�d	�|j|dd�tjj	dd
d�}|j|d|�dS(NRrtos2emxtriscositLibs
site-packagesit/itlibtpythonissite-python(R|R}(RRtgetsitepackagesRtplatformR*tlenRRR(tseptversion(R#tdirstwanted((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_getsitepackages�s"	cs`dt_dt_dt_t���}tjt	j
dd���d|d=|d=tj�}|j|j
dt	j�|�tj�}|j|j
|�|�WdQXWdQX�fd��d�_d�}tjt	j
d���stjtd	|��Wtjtd
t��;t�}tj|�|j�j|�|j|�WdQXWdQXWdQXdS(Nt
expandusercSs|S(N((R((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyRMRNRjtAPPDATAt~cs
|�_tS(N(targtFalse(R(t
fake_isdir(s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyR�#s	cWs
t�dS(N(tAssertionError(targs((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pytmust_not_be_called(sRRR
(RsRR
RR R!RRt	swap_attrRRRtRuRvR�RyR�RBRGtaddusersitepackagesR*R:(R#RkRwRzR�tknown_paths((R�s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_no_home_directorys,			%			
(t__name__t
__module__t__doc__R$R%R1R6R>RHRRWR`RbRtskipIfRR�ReRft
skipUnlessRR
RqRxR{R�R�(((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyR7s"			
					$	
!		
	R@cBs8eZdZedddd�Zd�Zed�ZRS(s/Helper class for handling testing of .pth filesttimet__testdir__t__badcCs�|d|_tjjd�|_tjj|j|j�|_||_||_||_	tjj|j|j�|_
tjj|j|j	�|_dS(sInitialize instance variabless.pthRNN(RFRRR+RER(t	file_pathR7tgood_dirnametbad_dirnameR9R<(R#t
filename_baseR7R�R�((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyt__init__;s
			cCswt|jd�}zC|dIJ|dIJ|d|jIJ||jIJ||jIJWd|j�Xtj|j�dS(soCreate a .pth file with a comment, blank lines, an ``import
        <self.imported>``, a line with self.good_dirname, and a line with
        self.bad_dirname.

        Creation of the directory for self.good_dir_path (based off of
        self.good_dirname) is also performed.

        Make sure to call self.cleanup() to undo anything done by this method.

        RJs#import @bad module names
s	import %sN(	ROR�R7R�R�RRRtmkdirR9(R#tFILE((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyRCGs


cCs�tjj|j�r(tj|j�n|rbtjj|j�|_	|j	r�tj|j=q�n|j	r�|j	tj|j<ntjj|j
�r�tj|j
�ntjj|j�r�tj|j�ndS(s�Make sure that the .pth file is deleted, self.imported is not in
        sys.modules, and that both self.good_dirname and self.bad_dirname are
        not existing directories.N(
RRR;R�RKRR8tgetR7timported_moduleR9trmdirR<(R#R?((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyRA]s		(R�R�R�RR�RCR�RA(((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyR@8s
	tImportSideEffectTestscBs�eZdZd�Zd�Zd�Zd�Zejd�d��Z	d�Z
d�Zd	�Zd
�Z
d�Zd�ZRS(
s(Test side-effects from importing 'site'.cCstj|_dS(sMake a copy of sys.pathN(RRR(R#((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyR$rscCs|jtj(dS(sRestore sys.pathN(RRR(R#((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyR%vscCshtj�xWtttfD]F}y)|jtjj|j�t	|��Wqt
k
r_qqXqWdS(N(Rtabs__file__RRt__builtin__RuRtisabst__file__treprtAttributeError(R#tmodule((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_abs__file__zs
)
cCsHtj�t�}x.tjD]#}|j||�|j|�qWdS(N(RtremoveduppathsRGRRtassertNotIntadd(R#t
seen_pathsR((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_no_duplicate_paths�s

	stest not implementedcCsdS(N((R#((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_add_build_dir�scCs0|jttd��|jttd��dS(Ntquittexit(RuthasattrR�(R#((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_setting_quit�scCs0|jttd��|jttd��dS(Nt	copyrighttcredits(RuR�R�(R#((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_setting_copyright�scCs|jttd��dS(Nthelp(RuR�R�(R#((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_setting_help�scCsxtjdkrtddl}|j�djd�rtx:tjjj�D]}|dkrGPqGqGW|jd�qtndS(NRci����itcptmbcssdid not alias mbcs(	RR�tlocaletgetdefaultlocaleRvt	encodingstaliasest
itervaluestfail(R#R�tvalue((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_aliasing_mbcs�scCs|jttd��dS(Ntsetdefaultencoding(RuR�R(R#((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_setdefaultencoding_removed�scCsGdtjkrCyddl}Wntk
r2qCX|jd�ndS(Nt
sitecustomizei����s(sitecustomize not imported automatically(RR8R�RaR�(R#R�((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyttest_sitecustomize_executed�s
(R�R�R�R$R%R�R�RtskipR�R�R�R�R�R�R�(((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyR�os									
	cCsttt�dS(N(RRR�(((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyt	test_main�st__main__( R�Rttest.test_supportRRRRttestRR�RRRR]R�RlR RR8RRRsR	RRtTestCaseRtobjectR@R�R�R�(((s5/usr/local/python-2.7/lib/python2.7/test/test_site.pyt<module>s4		�7O	
© 2025 GrazzMean