ó ¬ŒVPc@sàdZddlmZmZmZddlmZddlmZm Z ddl m Z m Z ddl mZddlmZddlmZd „Zd dd „ƒYZd e efd „ƒYZde efd„ƒYZdS(s» Tests for the command-line scripts in the top-level I{bin/} directory. Tests for actual functionality belong elsewhere, written in a way that doesn't involve launching child processes. iÿÿÿÿ(tdevnulltgetcwdtchdir(t executable(tPIPEtPopen(tSkipTesttTestCase(t getModule(tFilePath(tZshScriptTestMixincGspttdƒ}ttdƒ}tt|jgt|ƒdtd|d|ƒjjƒ}|j ƒ|j ƒ|S(sŽ Synchronously run a Python script, with the same Python interpreter that ran the process calling this function, using L{Popen}, using the given command-line arguments, with standard input and standard error both redirected to L{os.devnull}, and return its output as a string. @param script: The path to the script. @type script: L{FilePath} @param args: The command-line arguments to follow the script in its invocation (the desired C{sys.argv[1:]}). @type args: L{tuple} of L{str} @return: the output passed to the proces's C{stdout}, without any messages from C{stderr}. @rtype: L{bytes} trbtwbtstdouttstderrtstdin( tfileRRRtpathtlistRR treadtclose(tscripttargst nullInputt nullErrorR ((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pytoutputFromPythonScripts  tScriptTestsMixincBs2eZdZedƒjjjdƒZd„ZRS(sr Mixin for L{TestCase} subclasses which defines a helper function for testing a Twisted-using script. ttwistedtbincCsf|jj|ƒ}|jƒs-tdƒ‚nddlm}t|dƒ}|jt|ƒ|ƒdS(s Verify that the given script runs and uses the version of Twisted currently being tested. This only works when running tests against a vcs checkout of Twisted, since it relies on the scripts being in the place they are kept in version control, and exercises their logic for finding the right version of Twisted to use in that situation. @param name: A path fragment, relative to the I{bin} directory of a Twisted source checkout, identifying a script to test. @type name: C{str} @raise SkipTest: if the script is not where it is expected to be. s5Script tests do not apply to installed configuration.iÿÿÿÿ(tversions --versionN( Rt preauthChildtexistsRttwisted.copyrightRRtassertIntstr(tselftnameRRt scriptVersion((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyt scriptTest9s  ( t__name__t __module__t__doc__Rt pathEntrytfilePathtchildRR&(((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyR2st ScriptTestscBsqeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z RS( s% Tests for the core scripts. cCs|jdƒdS(Nttwistd(R&(R#((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyt test_twistdYscCs´|jjdƒ}|jƒs-tdƒ‚ntƒ}|jt|ƒt|jƒƒ}|j ƒt|j ƒ|jdƒj dƒt |ddƒ}|j t|j ƒ|ƒdS(s‡ The twistd script adds the current working directory to sys.path so that it's able to import modules from it. R.s5Script tests do not apply to installed configuration.sbar.tacsimport sys print sys.path s-nyN(RR,RRRt addCleanupRR tmktemptmakedirsRt setContentRR!trepr(R#RtcwdttestDirtoutput((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyttest_twistdPathInsert]s     cCs|jdƒdS(Ntmanhole(R&(R#((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyt test_manholerscCs|jdƒdS(Nttrial(R&(R#((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyt test_trialvscCs¨|jjdƒ}|jƒs-tdƒ‚ntƒ}|jt|ƒt|jƒƒ}|j ƒt|j ƒ|jdƒj dƒt |dƒ}|j d|ƒdS(s† The trial script adds the current working directory to sys.path so that it's able to import modules from it. R;s5Script tests do not apply to installed configuration.sfoo.pyttfootPASSEDN(RR,RRRR0RR R1R2RR3RR!(R#RR5R6R7((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyttest_trialPathInsertzs     cCs|jdƒdS(Nt pyhtmlizer(R&(R#((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyttest_pyhtmlizerscCs|jdƒdS(Nttap2rpm(R&(R#((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyt test_tap2rpm‘scCs|jdƒdS(Nttap2deb(R&(R#((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyt test_tap2deb•scCs|jdƒdS(Nt tapconvert(R&(R#((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyttest_tapconvert™scCsrddlm}|jd|jgƒ}|jt|ddƒ|jd|ddƒ|jdt|ƒƒd S( s„ The entire L{twisted.scripts.tkunzip} module, part of the old Windows installer tool chain, is deprecated. iÿÿÿÿ(ttkunziptoffendingFunctionsitcategorysetwisted.scripts.tkunzip was deprecated in Twisted 11.1.0: Seek unzipping software outside of Twisted.tmessageiN(ttwisted.scriptsRIt flushWarningsttest_deprecatedTkunzipt assertEqualtDeprecationWarningtlen(R#RItwarnings((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyROs cCsrddlm}|jd|jgƒ}|jt|ddƒ|jd|ddƒ|jdt|ƒƒd S( sP The entire L{twisted.scripts.tapconvert} module is deprecated. iÿÿÿÿ(RGRJiRKs\twisted.scripts.tapconvert was deprecated in Twisted 12.1.0: tapconvert has been deprecated.RLiN(RMRGRNttest_deprecatedTapconvertRPRQRR(R#RGRS((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyRT­s (R'R(R)R/R8R:R<R@RBRDRFRHRORT(((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyR-Us          tZshIntegrationTestCasecBs)eZdZdddddddgZRS(sH Test that zsh completion functions are generated without error R.s$twisted.scripts.twistd.ServerOptionsR;stwisted.scripts.trial.OptionsRAs twisted.scripts.htmlizer.OptionsRCs!twisted.scripts.tap2rpm.MyOptionsREs!twisted.scripts.tap2deb.MyOptionsRGs)twisted.scripts.tapconvert.ConvertOptionsR9s!twisted.scripts.manhole.MyOptions(stwistds$twisted.scripts.twistd.ServerOptions(strialstwisted.scripts.trial.Options(s pyhtmlizers twisted.scripts.htmlizer.Options(stap2rpms!twisted.scripts.tap2rpm.MyOptions(stap2debs!twisted.scripts.tap2deb.MyOptions(s tapconverts)twisted.scripts.tapconvert.ConvertOptions(smanholes!twisted.scripts.manhole.MyOptions(R'R(R)t generateFor(((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyRU½sN((R)tosRRRtsysRt subprocessRRttwisted.trial.unittestRRttwisted.python.modulesRttwisted.python.filepathR t"twisted.python.test.test_shellcompR RRR-RU(((sE/usr/lib/python2.7/dist-packages/twisted/scripts/test/test_scripts.pyt s #h