HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/twisted/test/__pycache__/test_main.cpython-38.pyc
U


W[�	�@s|dZddlmZmZddlZddlmZddlmZddl	m
Z
mZddlm
ZddlmZdd	lmZGd
d�de�ZdS)z6
Test that twisted scripts can be invoked as modules.
�)�division�absolute_importN)�TwistOptions)�trial)�defer�reactor)�NativeStringIO)�Accumulator)�TestCasec@s(eZdZdZdd�Zdd�Zdd�ZdS)	�	MainTestsz4Test that twisted scripts can be invoked as modules.csvtj}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__�argvcs<�j}|���dd�}t�}d�|��d�}��||�dS�Ns
�
z{}
zutf-8)�outF�getvalue�replacer�format�encode�assertEqual�Zign�f�outputZoptions�message��p�self��8/usr/lib/python3/dist-packages/twisted/test/test_main.py�processEnded"s
z,MainTests.test_twisted.<locals>.processEnded)�sys�
executabler	r�Deferred�
endedDeferredr�spawnProcess�	transport�
closeStdinr
r�patch�__file__�addCallback�r"�cmd�drr%r#r r$�test_twisteds
zMainTests.test_twistedcsvtj}t��t��}�_tj�||dddgdd��j�	�ddl
m}��td|j
dg���fd	d
�}|�|�S)z6Invoking python -m twisted.trial should execute trial.rz
twisted.trialrNrrrrcs>�j}|���dd�}t��}d�|��d�}��||�dSr)rrrrZOptionsrrrrr r#r$r%7s
z*MainTests.test_trial.<locals>.processEnded)r&r'r	rr(r)rr*r+r,Z
twisted.trialrr-r.r/r0r#r r$�
test_trial+s
zMainTests.test_trialcCsDt�}|�td|�}ddl}|�|j�|��|�|��d�dS)z2Importing twisted.__main__ does not execute twist.�stdoutrN�)	�StringIOr-r&Ztwisted.__main__Z
assertTruerZrestorerr)r"rZmonkeyr
r#r#r$�test_twisted_import@szMainTests.test_twisted_importN)�__name__�
__module__�__qualname__�__doc__r3r4r8r#r#r#r$rsr)r<Z
__future__rrr&Z"twisted.application.twist._optionsrZtwisted.scriptsrZtwisted.internetrrZtwisted.python.compatrr7Ztwisted.test.test_processr	Ztwisted.trial.unittestr
rr#r#r#r$�<module>s