
    Jf

                     b    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e	j                        Zy)	z)
Tests for L{twisted.runner.procmontap}.
    )
UsageError)
procmontap)ProcessMonitor)unittestc                   H    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
y)ProcessMonitorTapTestsz]
    Tests for L{twisted.runner.procmontap}'s option parsing and makeService
    method.
    Nc                 n    t        j                         }| j                  t        |j                  g        y)z>
        The command line arguments must be provided.
        N)tapOptionsassertRaisesr   parseOptionsselfopts     ^/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/twisted/runner/test/test_procmontap.pytest_commandLineRequiredz/ProcessMonitorTapTests.test_commandLineRequired   s'     kkm*c&6&6;    c                 |    t        j                         }|j                  g d       | j                  |d   d       y)za
        The threshold option is recognised as a parameter and coerced to
        float.
        )z--threshold7.5foo	threshold      @Nr
   r   r   assertEqualr   s     r   test_thresholdz%ProcessMonitorTapTests.test_threshold   s3    
 kkm67[)3/r   c                 |    t        j                         }|j                  g d       | j                  |d   d       y)zX
        The killtime option is recognised as a parameter and coerced to float.
        )z
--killtimer   r   killtimer   Nr   r   s     r   test_killTimez$ProcessMonitorTapTests.test_killTime$   s2     kkm56Z#.r   c                 |    t        j                         }|j                  g d       | j                  |d   d       y)zg
        The minrestartdelay option is recognised as a parameter and coerced to
        float.
        )z--minrestartdelayr   r   minrestartdelayr   Nr   r   s     r   test_minRestartDelayz+ProcessMonitorTapTests.test_minRestartDelay,   4    
 kkm<=./5r   c                 |    t        j                         }|j                  g d       | j                  |d   d       y)zg
        The maxrestartdelay option is recognised as a parameter and coerced to
        float.
        )z--maxrestartdelayr   r   maxrestartdelayr   Nr   r   s     r   test_maxRestartDelayz+ProcessMonitorTapTests.test_maxRestartDelay5   r"   r   c                     t        j                         }|j                  dg       | j                  |d   d       | j                  |d   d       | j                  |d   d       | j                  |d   d       y	)
z8
        The parameters all have default values
        r   r      r      r    r$   i  Nr   r   s     r   test_parameterDefaultsz-ProcessMonitorTapTests.test_parameterDefaults>   st     kkm%![)1-Z!,./3./6r   c                     t        j                         }|j                  g d       t        j                  |      }| j	                  |t
               | j                  d|j                         y)zP
        The command line gets added as a process to the ProcessMontor.
        )pingz-c3z8.8.8.8zping -c 3 8.8.8.8N)r
   r   r   makeServiceassertIsInstancer   assertIn	processes)r   r   ss      r   test_makeServicez'ProcessMonitorTapTests.test_makeServiceI   sO     kkm78OOC a0)1;;7r   )returnN)__name__
__module____qualname____doc__r   r   r   r!   r%   r)   r2    r   r   r   r      s*    
<0/66	78r   r   N)r7   twisted.python.usager   twisted.runnerr   r
   twisted.runner.procmonr   twisted.trialr   TestCaser   r8   r   r   <module>r>      s,    , , 1 "C8X.. C8r   