HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/twisted/test/__pycache__/test_main.cpython-310.pyc
o

�bv�@sTdZddlZddlmZddlmZmZddlmZddl	m
Z
Gdd�de
�ZdS)	z6
Test that twisted scripts can be invoked as modules.
�N)�StringIO)�defer�reactor)�Accumulator)�TestCasec@s(eZdZdZdd�Zdd�Zdd�ZdS)	�	MainTestsz4Test that twisted scripts can be invoked as modules.c�vtj}t��t��}�_tj�||dddgdd��j�	�ddl
m}��td|j
dg���fd	d
�}|�|�S)z0Invoking python -m twisted should execute twist.�-m�twisted�--helpN��envr��__main__�argvc�"�j}|��}��d|v|�dS)Ns,-m twisted [options] plugin [plugin_options]��outF�getvalue�
assertTrue��ign�f�output��p�self��8/usr/lib/python3/dist-packages/twisted/test/test_main.py�processEnded!s
�z,MainTests.test_twisted.<locals>.processEnded)�sys�
executablerr�Deferred�
endedDeferredr�spawnProcess�	transport�
closeStdinr
r�patch�__file__�addCallback�r�cmd�drrrrr�test_twisteds

zMainTests.test_twistedcr)z6Invoking python -m twisted.trial should execute trial.r	z
twisted.trialrNrrrrcr)Ns-j, --jobs= rrrrrr8sz*MainTests.test_trial.<locals>.processEnded)r r!rrr"r#rr$r%r&�
twisted.trialrr'r(r)r*rrr�
test_trial+s

zMainTests.test_trialcCsDt�}|�td|�}ddl}|�|j�|��|�|��d�dS)z2Importing twisted.__main__ does not execute twist.�stdoutrN�)	rr'r �twisted.__main__rr�restore�assertEqualr)rr�monkeyr
rrr�test_twisted_import@szMainTests.test_twisted_importN)�__name__�
__module__�__qualname__�__doc__r-r/r6rrrrrs
r)r:r �ior�twisted.internetrr�twisted.test.test_processr�twisted.trial.unittestrrrrrr�<module>s