Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/twisted/test/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/twisted/test/__pycache__/test_main.cpython-37.pyc

B

;��]�	�@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.z-m�twistedz--helpN)�envr)�__main__�argvcs<�j}|���dd�}t�}d�|��d�}��||�dS)Ns
�
z{}
zutf-8)�outF�getvalue�replacer�format�encode�assertEqual)�ign�f�output�options�message)�p�self��I/opt/alt/python37/lib64/python3.7/site-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)rrr�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.z-mz
twisted.trialz--helpN)r
r)rrcs>�j}|���dd�}t��}d�|��d�}��||�dS)Ns
rz{}
zutf-8)rrrrZOptionsrrr)rrrrr)rrrrr 7s
z*MainTests.test_trial.<locals>.processEnded)r!r"r	rr#r$rr%r&r'Z
twisted.trialrr(r)r*)rr+r,rr r)rrr�
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)rr�monkeyrrrr�test_twisted_import@szMainTests.test_twisted_importN)�__name__�
__module__�__qualname__�__doc__r-r.r3rrrrrsr)r7�
__future__rrr!Z"twisted.application.twist._optionsrZtwisted.scriptsrZtwisted.internetrrZtwisted.python.compatrr1Ztwisted.test.test_processr	Ztwisted.trial.unittestr
rrrrr�<module>s