U
    
W[Ø	  ã                   @   sJ   d Z ddlmZ ddlmZ ddlmZ ddlmZ	 G dd„ dej
ƒZdS )	z)
Tests for L{twisted.runner.procmontap}.
é    )Ú
UsageError)Úunittest)ÚProcessMonitor)Ú
procmontapc                   @   sH   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dS )ÚProcessMonitorTapTestsz]
    Tests for L{twisted.runner.procmontap}'s option parsing and makeService
    method.
    c                 C   s   t  ¡ }|  t|jg ¡ dS )z>
        The command line arguments must be provided.
        N)ÚtapÚOptionsZassertRaisesr   ÚparseOptions©ÚselfÚopt© r   úE/usr/lib/python3/dist-packages/twisted/runner/test/test_procmontap.pyÚtest_commandLineRequired   s    z/ProcessMonitorTapTests.test_commandLineRequiredc                 C   s,   t  ¡ }| dddg¡ |  |d d¡ dS )za
        The threshold option is recognised as a parameter and coerced to
        float.
        z--thresholdú7.5ÚfooÚ	thresholdç      @N©r   r   r	   ZassertEqualr
   r   r   r   Útest_threshold   s    z%ProcessMonitorTapTests.test_thresholdc                 C   s,   t  ¡ }| dddg¡ |  |d d¡ dS )zX
        The killtime option is recognised as a parameter and coerced to float.
        z
--killtimer   r   Úkilltimer   Nr   r
   r   r   r   Útest_killTime&   s    z$ProcessMonitorTapTests.test_killTimec                 C   s,   t  ¡ }| dddg¡ |  |d d¡ dS )zg
        The minrestartdelay option is recognised as a parameter and coerced to
        float.
        z--minrestartdelayr   r   Úminrestartdelayr   Nr   r
   r   r   r   Útest_minRestartDelay/   s    z+ProcessMonitorTapTests.test_minRestartDelayc                 C   s,   t  ¡ }| dddg¡ |  |d d¡ dS )zg
        The maxrestartdelay option is recognised as a parameter and coerced to
        float.
        z--maxrestartdelayr   r   Úmaxrestartdelayr   Nr   r
   r   r   r   Útest_maxRestartDelay9   s    z+ProcessMonitorTapTests.test_maxRestartDelayc                 C   sX   t  ¡ }| dg¡ |  |d d¡ |  |d d¡ |  |d d¡ |  |d d¡ d	S )
z8
        The parameters all have default values
        r   r   é   r   é   r   r   i  Nr   r
   r   r   r   Útest_parameterDefaultsC   s    z-ProcessMonitorTapTests.test_parameterDefaultsc                 C   sB   t  ¡ }| ddddg¡ t  |¡}|  |t¡ |  d|j¡ dS )zP
        The command line gets added as a process to the ProcessMontor.
        Zpingz-cÚ3z8.8.8.8zping -c 3 8.8.8.8N)r   r   r	   ZmakeServiceZassertIsInstancer   ZassertInZ	processes)r   r   Úsr   r   r   Útest_makeServiceO   s
    
z'ProcessMonitorTapTests.test_makeServiceN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r!   r   r   r   r   r      s   
	

r   N)r%   Ztwisted.python.usager   Ztwisted.trialr   Ztwisted.runner.procmonr   Ztwisted.runnerr   r   ZTestCaser   r   r   r   r   Ú<module>   s
   