%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/test/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/test/test_site.pyc

ó
Nêáac@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((s*/usr/local/lib/python2.7/test/test_site.pytsetUpModule!s
	cCsttj(dS(N(R	RR(((s*/usr/local/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((s*/usr/local/lib/python2.7/test/test_site.pytsetUp?s

cCsA|jtj(|jt_|jt_|jt_	|j
t_dS(sRestore sys.pathN(
RRRRRRRR
RRR"R R!(R#((s*/usr/local/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((s*/usr/local/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((s*/usr/local/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((s*/usr/local/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=((s*/usr/local/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(s*/usr/local/lib/python2.7/test/test_site.pyt<lambda>€t(RRR+R(topent
addCleanuptwritetclose(R#tcontentstpth_dirtpth_nametpth_basenameR=((RLs*/usr/local/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((s*/usr/local/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_((s*/usr/local/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_((s*/usr/local/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=((s*/usr/local/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((s*/usr/local/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((s*/usr/local/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((s*/usr/local/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((s*/usr/local/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((s*/usr/local/lib/python2.7/test/test_site.pyRMRNRjtAPPDATAt~cs
|ˆ_tS(N(targtFalse(R(t
fake_isdir(s*/usr/local/lib/python2.7/test/test_site.pyR#s	cWs
t‚dS(N(tAssertionError(targs((s*/usr/local/lib/python2.7/test/test_site.pytmust_not_be_called(sRRR
(RsRR
RR R!RRt	swap_attrRRRtRuRvR…RyRRBRGtaddusersitepackagesR*R:(R#RkRwRzR’tknown_paths((Rs*/usr/local/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–(((s*/usr/local/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¡((s*/usr/local/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((s*/usr/local/lib/python2.7/test/test_site.pyRCGs


cCsÕtjj|jƒr(tj|jƒn|rbtjj|jƒ|_	|j	rtj|j=qn|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?((s*/usr/local/lib/python2.7/test/test_site.pyRA]s		(R—R˜R™RR£RCRŽRA(((s*/usr/local/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#((s*/usr/local/lib/python2.7/test/test_site.pyR$rscCs|jtj(dS(sRestore sys.pathN(RRR(R#((s*/usr/local/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((s*/usr/local/lib/python2.7/test/test_site.pyttest_abs__file__zs
)
cCsHtjƒtƒ}x.tjD]#}|j||ƒ|j|ƒqWdS(N(RtremoveduppathsRGRRtassertNotIntadd(R#t
seen_pathsR((s*/usr/local/lib/python2.7/test/test_site.pyttest_no_duplicate_pathsˆs

	stest not implementedcCsdS(N((R#((s*/usr/local/lib/python2.7/test/test_site.pyttest_add_build_dir‘scCs0|jttdƒƒ|jttdƒƒdS(Ntquittexit(RuthasattrR«(R#((s*/usr/local/lib/python2.7/test/test_site.pyttest_setting_quit˜scCs0|jttdƒƒ|jttdƒƒdS(Nt	copyrighttcredits(RuRºR«(R#((s*/usr/local/lib/python2.7/test/test_site.pyttest_setting_copyrightscCs|jttdƒƒdS(Nthelp(RuRºR«(R#((s*/usr/local/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((s*/usr/local/lib/python2.7/test/test_site.pyttest_aliasing_mbcs¦scCs|jttdƒƒdS(Ntsetdefaultencoding(RuRºR(R#((s*/usr/local/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Í((s*/usr/local/lib/python2.7/test/test_site.pyttest_sitecustomize_executed´s
(R—R˜R™R$R%R±R¶RtskipR·R»R¾RÀRÊRÌRÎ(((s*/usr/local/lib/python2.7/test/test_site.pyR©os									
	cCstttƒdS(N(RRR©(((s*/usr/local/lib/python2.7/test/test_site.pyt	test_main¾st__main__( R™Rttest.test_supportRRRRttestRR«RRRR]RÅRlR RR8RRRsR	RRtTestCaseRtobjectR@R©RÐR—(((s*/usr/local/lib/python2.7/test/test_site.pyt<module>s4		ÿ7O	

Zerion Mini Shell 1.0