ϪfvZdZddlZddlmZddlmZmZddlmZddl m Z Gdde Z y) z6 Test that twisted scripts can be invoked as modules. N)StringIO)deferreactor) Accumulator)TestCasec"eZdZdZdZdZdZy) MainTestsz4Test that twisted scripts can be invoked as modules.c^tj}ttjx}_t j||dddgdjjddl m }jtd|jdgfd }|j|S) z0Invoking python -m twisted should execute twist.-mtwisted--helpNenvr__main__argvcfj}|j}jd|v|y)Ns,-m twisted [options] plugin [plugin_options]outFgetvalue assertTrueignfoutputpselfs 8/usr/lib/python3/dist-packages/twisted/test/test_main.py processEndedz,MainTests.test_twisted..processEnded!s-AZZ\F OO?6I6 )sys executablerrDeferred endedDeferredr spawnProcess transport closeStdinr rpatch__file__ addCallbackrcmddrrrs` @r test_twistedzMainTests.test_twistedsnn M#nn..AOQc4H%E4P   % 3!2!2H => }}\**r c^tj}ttjx}_t j||dddgdjjddl m }jtd|jdgfd }|j|S) z6Invoking python -m twisted.trial should execute trial.r z twisted.trialr Nrrrrcfj}|j}jd|v|y)Ns -j, --jobs= rrs rrz*MainTests.test_trial..processEnded8s*AZZ\F OOOv5v >r )r!r"rrr#r$rr%r&r' twisted.trialrr(r)r*r+s` @r test_trialzMainTests.test_trial+snn M#nn..AOQc4(%KQUV   + 3!2!2H => ? }}\**r ct}|jtd|}ddl}|j |j |j |j|jdy)z2Importing twisted.__main__ does not execute twist.stdoutrN) rr(r!twisted.__main__rrrestore assertEqualr)rrmonkeyr s rtest_twisted_importzMainTests.test_twisted_import@sQC62 (() *B/r N)__name__ __module__ __qualname____doc__r.r2r:r rr r s>+.+* 0r r ) r>r!iortwisted.internetrrtwisted.test.test_processrtwisted.trial.unittestrr r?r rrDs'  +1+9090r