403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python2.7/dist-packages/twisted/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyc
ó
ê=Nc@sdZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZd	efd
„ƒYZdefd„ƒYZd
efd„ƒYZdefd„ƒYZdefd„ƒYZdS(sV
Tests for twisted.python.modules, abstract access to imported or importable
objects.
iÿÿÿÿN(tTestCase(tmodules(tFilePath(tnamedAny(tTwistedModulesTestCase(tzipitt
BasicTestscBsteZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
RS(cCs°tdƒd}|jƒ}|jdƒ}|jdƒj|ƒ|jdƒ}|jƒ|jdƒj|ƒ|jdƒjdƒ|jƒ}|jdƒ}|jdƒj|ƒ|jdƒ}|jƒ|jdƒj|ƒ|jdƒjdƒ|j|j|jgƒtjdƒ}z,g|j	d	t
ƒD]}	|	j^q:}
Wd
x3tjj
ƒD]"}|jdƒrctj|=qcqcWXdddd
g}|j|
|ƒd
S(sd
        Duplicate packages are not yielded when iterating over namespace
        packages.
        tpkgutilsBimport pkgutil; __path__ = pkgutil.extend_path(__path__, __name__)ttest_packages__init__.pytnested_packages	module.pyts
module2.pytimportPackagesNstest_package.nested_packages"test_package.nested_package.modules#test_package.nested_package.module2(t
__import__tpathEntryWithOnePackagetchildt
setContenttmakedirstreplaceSysPathtpathRt	getModuletwalkModulestTruetnametsystkeyst
startswithtassertEqual(tselftnamespaceBoilerplatetentryttestPackagePathtnestedEntrytanotherEntrytanotherPackagePathtanotherNestedEntrytmoduletmodtwalkedNamestexpected((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_namespacedPackagess8


,	c
Cstg}tjd|jƒjgd|jdidididd6ƒ}|j|gƒ|j|djƒtƒdS(s
        If a package has been explicitly forbidden from importing by setting a
        C{None} key in sys.modules under its name,
        L{modules.PythonPath.__getitem__} should still be able to retrieve an
        unloaded L{modules.PythonModule} for that package.
        tsysPathtmoduleLoadert
importerCachetsysPathHookst
moduleDictRN(	Rt
PythonPathR
RtappendtNoneRtisLoadedtFalse(Rt
shouldNotLoadR((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_unimportablePackageGetItemjs	cCsŒ|jƒ}|j|jgƒ|jidd6ƒttjƒƒ}|jg|D]}|j	^qRdgƒ|j|dj
ƒtƒdS(s	
        If a package has been explicitly forbidden from importing by setting a
        C{None} key in sys.modules under its name, L{modules.walkModules} should
        still be able to retrieve an unloaded L{modules.PythonModule} for that
        package.
        RiN(R
RRtreplaceSysModulesR/tlistRRRRR0R1(RtexistentPathtwalkedtm((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyt#test_unimportablePackageWalkModules{s
cCs±|jƒ}t|jƒƒ}|j|jƒƒ|j|jgƒtjdƒg}t	tj
ƒƒ}tjj|jƒt	tj
ƒƒ}|j
||ƒ|j
||ƒdS(s~
        Verify that L{modules.walkModules} ignores entries in sys.path which
        do not exist in the filesystem.
        RN(R
RtmktemptfailIftexistsRRRRR5RRR.R(RR6tnonexistentPathR&t
beforeModulestafterModules((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_nonexistentPathsŒscCsœ|jƒ}t|jƒƒ}|j|jƒƒ|jdƒ|j|jgƒtt	j
ƒƒ}tjj|jƒtt	j
ƒƒ}|j
||ƒdS(sˆ
        Verify that L{modules.walkModules} ignores entries in sys.path which
        refer to regular files in the filesystem.
        szip file or whatever
N(R
RR:R;R<RRRR5RRRR.R(RR6tnonDirectoryPathR>R?((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_nonDirectoryPaths¢s
cCs&|jtjdƒ|jdƒƒdS(së
        Scrounge around in the top-level module namespace and make sure that
        Twisted shows up, and that the module thusly obtained is the same as
        the module that we find when we look for it explicitly by name.
        ttwistedN(RRRtfindByIteration(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_twistedShowsUp¶scCs5|jtjdƒ|jddtjdƒƒƒdS(so
        Verify that the walkModules APIs will give us back subpackages, not just
        subpackages.
        stwisted.pythontwhereRCN(RRRRD(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_dottedNamesÀscCs;x4tjƒD]&}|jd|jkd|jƒq
WdS(s‰
        Verify that the iterModules API will only return top-level modules and
        packages, not submodules or subpackages.
        t.s9no nested modules should be returned from iterModules: %rN(RtiterModulesR;RtfilePath(RR#((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_onlyTopModulesËs
cCskxdddddgD]P}t|ƒ}|jtj|ƒjƒ|ƒ|j|j|ƒjƒ|ƒqWdS(sl
        Verify that we can locate and load packages, modules, submodules, and
        subpackages.
        tosRCstwisted.pythonstwisted.python.reflectN(RtfailUnlessIdenticalRRtloadRD(RtnR8((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_loadPackagesAndModules×s
cCsFx?ddddgD]+}|jtj|ƒjjjtjƒqWdS(su
        Verify that path entries discovered via module loading are, in fact, on
        sys.path somewhere.
        RLRCstwisted.pythonstwisted.python.reflectN(tfailUnlessInRRt	pathEntryRJRR(RRO((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_pathEntriesOnPathés
csÁt|jƒƒ}|jƒtjd|jgƒ}|j‰‡fd†}|jdƒjdƒt	j
|jdtƒ|jt
|jƒƒdƒ||_|j|dj|jdƒƒdS(	s~
        Verify that .py files will always be preferred to .pyc files, regardless of
        directory listing order.
        R(cs1ˆ|ƒ}|j‰‡fd†}||_|S(Ncs!ˆƒ}|jƒ|jƒ|S(N(tsorttreverse(tx(toriginalChildren(s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pytevilChildrens	

(tchildren(tpathNametoRX(toriginalSmartPath(RWs=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyt_evilSmartPaths
		sabcd.pys
tquietitabcdN(RR:tcreateDirectoryRR-Rt
_smartPathRRt
compilealltcompile_dirRRtlenRYRJ(RtmypathtppR]((R\s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_alwaysPreferPy÷s
		cCsèt|jƒƒ}|jƒtjd|jgƒ}|jdƒ}|jƒ|jdƒjdƒtjj	|jƒt
dƒzCt|jƒƒ}|j
t|ƒdƒ|j
|djdƒWdtjd=tjj|jƒXdS(sƒ
        A package can delete its __path__ for some reasons,
        C{modules.PythonPath} should be able to deal with it.
        R(R_s__init__.pys
del __path__
iiN(RR:R`RR-RRRRR.RR5RRRdRtremove(RReRftsubpathtl((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_packageMissingPaths



(t__name__t
__module__R'R3R9R@RBRERGRKRPRSRgRk(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyRs	N					
					tPathModificationTestcBszeZdZejƒjZd„Zd„Ze	d„Z
d„Zd„Zde_
d„Zd„Zd	„Zd
„ZRS(sp
    These tests share setup/cleanup behavior of creating a dummy package and
    stuffing some code in it.
    cCsÚ|jƒ|_t|jƒ|_|jjƒd|jƒf|_|jj|jƒ|_|jjƒ|jjdƒj	dƒ|jjdƒj	dƒ|jjdƒj	dƒ|jjdƒj	dƒt
|_dS(Nspyspacetests%ds__init__.pyR
sa.pysb.pysc__init__.py(R:tpathExtensionNameRt
pathExtensionR`t
_serialnumtpackageNameRtpackagePathRR1t	pathSetUp(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pytsetUp5s

cCs0|jst‚t|_tjj|jƒdS(N(RttAssertionErrorRRRR.Ro(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyt
_setupSysPathCs	cCsÂ|jƒ}t|ƒ}|jƒ|jdƒjdƒ|jjdƒjd|fƒ|jƒtj|j	ƒ}|j
|j|j	d|d|ƒ|dƒ|j
|djƒj
dƒdS(	Ns	foozle.pysx = 123
s__init__.pys__path__.append(%r)
s.foozleRtfoozlei{(R:RR`RRRsRwRRRrRRDRNRV(RtdoImporttmoddir2tfpmdtmodinfo((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyt_underUnderPathTestIs

cCs|jƒdS(s]
        Verify that iterModules will honor the __path__ of already-loaded packages.
        N(R}(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyt"test_underUnderPathAlreadyImportedZscCs|jtƒdS(s]
        Verify that iterModules will honor the __path__ of already-loaded packages.
        N(R}R1(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyt%test_underUnderPathNotAlreadyImportedass1This may be impossible but it sure would be nice.cCshtj|jƒ}g|jƒD]}|jjdƒd^q}|jƒ|j|dddgƒdS(NRHiÿÿÿÿtatbt	c__init__(RRRrRIRtsplitRTR(RtpkginfoR|tnfni((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyt_listModulesls
,
cCs|jƒ|jƒdS(s
        Make sure the module list comes back as we expect from iterModules on a
        package, whether zipped or not.
        N(RwR†(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_listingModulests
cCs%|jƒt|jƒ|jƒdS(s¸
        Make sure the module list comes back as we expect from iterModules on a
        package, whether zipped or not, even if the package has already been
        imported.
        N(RwRRrR†(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyt"test_listingModulesAlreadyImported}s

cCs`|jr\d}tjjƒ|jks7t|dƒ‚|jtjks\t|dƒ‚ndS(Ns<path cleanup failed: don't be surprised if other tests breaks, 1s, 2(RtRRtpopRoRv(RtHORK((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttearDownˆs	((RlRmt__doc__t	itertoolstcounttnextRqRuRwRR}R~RttodoR†R‡RˆR‹(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyRn,s									t
RebindingTestcBs eZdZd„Zd„ZRS(s’
    These tests verify that the default path interrogation API works properly
    even when sys.path has been rebound to a different object.
    cCsI|jst‚t|_tj|_tjt_tjj|jƒdS(N(RtRvRRRtsavedSysPathR.Ro(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyRw—s
	
cCs|jr|jt_ndS(sF
        Clean up sys.path by re-binding our original object.
        N(RtR’RR(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyR‹Ÿs	(RlRmRŒRwR‹(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyR‘’s	tZipPathModificationTestcBseZd„ZRS(cCs_|jst‚t|j|jdƒ|jd7_tj|jƒsNt‚tj|ƒdS(Ns.zip(RtRvRRotzipfilet
is_zipfileRnRw(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyRw©s
(RlRmRw(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyR“¨stPythonPathTestCasecBs eZdZd„Zd„ZRS(sŠ
    Tests for the class which provides the implementation for all of the
    public API of L{twisted.python.modules}, L{PythonPath}.
    cs¬dtfd„ƒY‰‡fd†}dg}i}|g}i}d„}tj|||||ƒ}t|jƒƒ‰|jtˆƒdƒ|jt‡fd†ƒdS(	s}
        Make sure that the behavior when encountering an unknown importer
        type is not catastrophic failure.
        tSecretImportercBseZRS((RlRm(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyR—»scsˆƒS(N((R(R—(s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pythook¾ssexample/pathcSsdS(N(R/(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyt	sysloaderÅsicsˆddS(NiR#(((tentries(s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyt<lambda>ËsN(	tobjectRR-R5titerEntriesRRdtassertRaisestKeyError(RR˜tsyspatht
sysmodulestsyshookstsyscacheR™tspace((R—Ršs=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyttest_unhandledImporter¶s			cCs¸tjgtjgiƒ}|t}|j|jgƒ}|j|ddtƒ|j|ddtt	j
ƒjƒjƒdtdƒ|jt
|ƒdƒ|j|jtƒdS(sË
        If the path a module loaded with L{PythonPath.__getitem__} is not
        present in the path importer cache, a warning is emitted, but the
        L{PythonModule} is returned as usual.
        itcategorytmessages
 (for module sR) not in path importer cache (PEP 302 violation - check your local configuration).iN(RR-RRlt
flushWarningsttest_inconsistentImporterCacheRtUserWarningRRCt__file__tparenttdirnameRdR(RR¤t
thisModuletwarnings((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyR©Îs
((RlRmRŒR¥R©(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyR–±s	(RŒRRR”RbRCttwisted.trial.unittestRttwisted.pythonRttwisted.python.filepathRttwisted.python.reflectRt#twisted.python.test.modules_helpersRttwisted.test.test_pathsRRRnR‘R“R–(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_modules.pyt<module>s"ÿf	

Youez - 2016 - github.com/yon3zu
LinuXploit