
    Ϫfd                         d Z ddlZddlmZmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZmZ dd	lmZ  G d
 d      Z G d de	e      Z G d dej*                        Z G d dej.                        Zy)z&
Tests for L{twisted.runner.procmon}.
    N)ProcessDoneProcessExitedAlreadyProcessTerminated)Clock)MemoryReactor)globalLogPublisher)Failure)LoggingProtocolProcessMonitor)unittestc                   8    e Zd ZdZdZdZdZ	 	 	 	 ddZd Zd Z	y)DummyProcessa   
    An incomplete and fake L{IProcessTransport} implementation for testing how
    L{ProcessMonitor} behaves when its monitored processes exit.

    @ivar _terminationDelay: the delay in seconds after which the DummyProcess
        will appear to exit when it receives a TERM signal
       Nc                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        y N)
proto_reactor_executable_args_environment_path_uid_gid_usePTY	_childFDs)selfreactor
executableargsenvironmentpathr   uidgidusePTYchildFDss              B/usr/lib/python3/dist-packages/twisted/runner/test/test_procmon.py__init__zDummyProcess.__init__    sL     
%
'
		!    c                     | j                   dfdd}| j                  
t               ||v r5||   \  }}| j                  j	                  || j
                  |      | _        yy)a  
        A partial implementation of signalProcess which can only handle TERM and
        KILL signals.
         - When a TERM signal is given, the dummy process will appear to exit
           after L{DummyProcess._terminationDelay} seconds with exit code 0
         - When a KILL signal is given, the dummy process will appear to exit
           immediately with exit code 1.

        @param signalID: The signal name or number to be issued to the process.
        @type signalID: C{str}
        r   r   r   )TERMKILLN)_terminationDelaypidr   r   	callLaterprocessEnded_signalHandler)r   signalIDparamsdelaystatuss        r&   signalProcesszDummyProcess.signalProcess9   sk      1115vF88&((v"8,ME6"&--"9"9t((&#D r(   c                     d| _         t        t        d}| j                  j	                  t         ||   |                   y)zC
        Deliver the process ended event to C{self.proto}.
        Nr*   )r.   r   r   r   r0   r	   )r   r5   	statusMaps      r&   r0   zDummyProcess.processEndedP   s>      
	 	

(9	&(9&(A BCr(   )NNr   N)
__name__
__module____qualname____doc__r.   r   r-   r'   r6   r0    r(   r&   r   r      s7     CE "2.	Dr(   r   c                   ,    e Zd ZdZd Zdi dddddfdZy)DummyProcessReactorz
    @ivar spawnedProcesses: a list that keeps track of the fake process
        instances built by C{spawnProcess}.
    @type spawnedProcesses: C{list}
    c                 f    t        j                  |        t        j                  |        g | _        y r   )r   r'   r   spawnedProcessesr   s    r&   r'   zDummyProcessReactor.__init__c   s$    t$t "r(   r=   Nr   c
                     t        | |||||||||	
      }
|j                  |
       | j                  j                  |
       |
S )zz
        Fake L{reactor.spawnProcess}, that logs all the process
        arguments and returns a L{DummyProcess}.
        )r   makeConnectionrA   append)r   processProtocolr   r   envr!   r"   r#   r$   r%   procs              r&   spawnProcessz DummyProcessReactor.spawnProcessi   sU    " 
 	&&t,$$T*r(   )r9   r:   r;   r<   r'   rI   r=   r(   r&   r?   r?   \   s(    # r(   r?   c                       e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d  Z"d! Z#y")#ProcmonTestsz&
    Tests for L{ProcessMonitor}.
    c                     t               | _        t        | j                        | _        d| j                  _        d| j                  _        d| j                  _        y)zL
        Create an L{ProcessMonitor} wrapped around a fake reactor.
        r      
   N)r?   r   r   pmminRestartDelaymaxRestartDelay	thresholdrB   s    r&   setUpzProcmonTests.setUp   sB     +, 6"#"$r(   c                     | j                   j                  dddgddi        t        | j                         }| j                  d|       | j                  d|       | j                  d|       y	)
z+
        Repr includes all details
        fooarg1arg2r   rN   r"   r#   rG   12N)rP   
addProcessreprassertInr   representations     r&   test_reprLooksGoodzProcmonTests.test_reprLooksGood   s]     	566"2qbIdgge^,c>*c>*r(   c                     | j                   j                  dddgi        t        | j                         }| j                  d|       | j                  d|       y)z
        Repr does not include unneeded details.

        Values of attributes that just mean "inherit from launching
        process" do not appear in the repr of a process.
        rV   rW   rX   )rG   ()N)rP   r\   r]   assertNotInr_   s     r&   test_simpleReprLooksGoodz%ProcmonTests.test_simpleReprLooksGood   sO     	566"2;dggn-n-r(   c                     | j                   j                  dddgddi        | j                  | j                   j                         d   dddgddi fi       y)	zW
        The list of monitored processes must be included in the pickle state.
        rV   rW   rX   r   rN   rY   	processesN)rP   r\   assertEqual__getstate__rB   s    r&   test_getStateIncludesProcessesz+ProcmonTests.test_getStateIncludesProcesses   s_     	566"2qbIGG  ";/%66:JAqRT9U1V	
r(   c                 X    | j                  d| j                  j                                y)z~
        The private L{ProcessMonitor._reactor} instance variable should not be
        included in the pickle state.
        r   N)re   rP   rj   rB   s    r&   test_getStateExcludesReactorz)ProcmonTests.test_getStateExcludesReactor   s!    
 	TWW%9%9%;<r(   c                    | j                   j                  dddgddi        | j                  | j                   j                  i        | j                  | j                   j                  dddgddi fi       | j                   j                          | j                  j                  d       | j                  t        | j                   j                  j                               dg       y)	z
        L{ProcessMonitor.addProcess} only starts the named program if
        L{ProcessMonitor.startService} has been called.
        rV   rW   rX   r   rN   rY   r   N)
rP   r\   ri   	protocolsrh   startServicer   advancelistkeysrB   s    r&   test_addProcesszProcmonTests.test_addProcess   s    
 	566"2qbI**B/**Uff5Eq!R4P,QRQdgg//4467%Ar(   c           	          | j                   j                  dddgddi        | j                  t        | j                   j                  dddgddi        y)z|
        L{ProcessMonitor.addProcess} raises a C{KeyError} if a process with the
        given name already exists.
        rV   rW   rX   r   rN   rY   N)rP   r\   assertRaisesKeyErrorrB   s    r&    test_addProcessDuplicateKeyErrorz-ProcmonTests.test_addProcessDuplicateKeyError   sX    
 	566"2qbIdgg((%&&1AqaUW 	 	
r(   c                    ddi}| j                   j                          | j                   j                  ddgdd|       | j                  j	                  d       | j                  | j                  j                  d   j                  |       y)	z
        L{ProcessMonitor.addProcess} takes an C{env} parameter that is passed to
        L{IReactorProcess.spawnProcess}.
        KEYvaluerV   r   rN   rY   r   N)rP   rp   r\   r   rq   ri   rA   r   )r   fakeEnvs     r&   test_addProcessEnvzProcmonTests.test_addProcessEnv   st    
 '"55'qaWEQ66q9FFPr(   c                    | j                   j                          | j                   j                  ddgd       | j                  j	                  d       | j                  | j                  j                  d   j                  d       y)z
        L{ProcessMonitor.addProcess} takes an C{cwd} parameter that is passed
        to L{IReactorProcess.spawnProcess}.
        rV   z	/mnt/lala)cwdr   N)rP   rp   r\   r   rq   ri   rA   r   rB   s    r&   test_addProcessCwdzProcmonTests.test_addProcessCwd   sf    
 	55'{;Q66q9??Mr(   c                 d   | j                   j                          | j                   j                  ddg       | j                  t	        | j                   j
                        d       | j                   j                  d       | j                  t	        | j                   j
                        d       y)zm
        L{ProcessMonitor.removeProcess} removes the process from the public
        processes list.
        rV   r   r   N)rP   rp   r\   ri   lenrh   removeProcessrB   s    r&   test_removeProcesszProcmonTests.test_removeProcess   sz    
 	55'*TWW../3e$TWW../3r(   c                     | j                   j                          | j                  t        | j                   j                  d       y)zz
        L{ProcessMonitor.removeProcess} raises a C{KeyError} if the given
        process name isn't recognised.
        rV   N)rP   rp   rv   rw   r   rB   s    r&   !test_removeProcessUnknownKeyErrorz.ProcmonTests.test_removeProcessUnknownKeyError   s0    
 	(DGG$9$95Ar(   c                 6   | j                   j                  ddg       | j                   j                  d       | j                  | j                   j                  d   t
               | j                  d| j                   j                  j                                y)a  
        When a process has been started, an instance of L{LoggingProtocol} will
        be added to the L{ProcessMonitor.protocols} dict and the start time of
        the process will be recorded in the L{ProcessMonitor.timeStarted}
        dictionary.
        rV   N)	rP   r\   startProcessassertIsInstancero   r
   r^   timeStartedrs   rB   s    r&   test_startProcesszProcmonTests.test_startProcess   sl     	55'*U#dgg//6HeTWW005578r(   c                     | j                   j                  ddg       | j                   j                  d       | j                  | j                   j                  d             y)zr
        L{ProcessMonitor.startProcess} silently returns if the named process is
        already started.
        rV   N)rP   r\   r   assertIsNonerB   s    r&   test_startProcessAlreadyStartedz,ProcmonTests.test_startProcessAlreadyStarted
  sI    
 	55'*U#$''..u56r(   c                 Z    | j                  t        | j                  j                  d       y)zy
        L{ProcessMonitor.startProcess} raises a C{KeyError} if the given
        process name isn't recognised.
        rV   N)rv   rw   rP   r   rB   s    r&    test_startProcessUnknownKeyErrorz-ProcmonTests.test_startProcessUnknownKeyError  s     
 	(DGG$8$8%@r(   c                    | j                   j                          | j                   j                  ddg       | j                  d| j                   j                         dx}| j                   j                  d   j
                  _        | j                  j                  | j                   j                         | j                   j                  d       | j                  j                  |       | j                  j                  d       | j                  | j                  j                         | j                   j                  d          y)zm
        L{ProcessMonitor.stopProcess} immediately sends a TERM signal to the
        named process.
        rV   r   r   N)rP   rp   r\   r^   ro   	transportr-   r   rq   rS   stopProcessri   secondsr   )r   	timeToDies     r&   "test_stopProcessNaturalTerminationz/ProcmonTests.test_stopProcessNaturalTermination  s    
 	55'*eTWW../ LML	DGG%%e,66H 	TWW../E" 	Y'
 	Q 	--/1D1DU1KLr(   c                 |   | j                   j                          | j                   j                  ddg       | j                  d| j                   j                         | j
                  j                  | j                   j                         | j                   j                  d   j                  }| j                   j                  dz   |_
        | j                   j                  d       | j
                  j                  | j                   j                  dz
         | j                  d| j                   j                  d          | j
                  j                  d       | j
                  j                  ddg       | j                  | j
                  j                         | j                   j                  d          y)z
        L{ProcessMonitor.stopProcess} kills a process which fails to terminate
        naturally within L{ProcessMonitor.killTime} seconds.
        rV   r   g        r   N)rP   rp   r\   r^   ro   r   rq   rS   r   killTimer-   r   ri   r   pumpr   )r   rH   s     r&   test_stopProcessForcedKillz'ProcmonTests.test_stopProcessForcedKill8  s9   
 	55'*eTWW../TWW../ww  '11!%!1!1A!5E" 	TWW--12dgg11%89Q 	1a&!--/1D1DU1KLr(   c                 Z    | j                  t        | j                  j                  d       y)zx
        L{ProcessMonitor.stopProcess} raises a C{KeyError} if the given process
        name isn't recognised.
        rV   N)rv   rw   rP   r   rB   s    r&   test_stopProcessUnknownKeyErrorz,ProcmonTests.test_stopProcessUnknownKeyErrorU  s     
 	(DGG$7$7?r(   c                     | j                   j                  ddg       | j                  | j                   j                  d             y)z
        L{ProcessMonitor.stopProcess} silently returns if the named process
        is already stopped. eg Process has crashed and a restart has been
        rescheduled, but in the meantime, the service is stopped.
        rV   N)rP   r\   r   r   rB   s    r&   test_stopProcessAlreadyStoppedz+ProcmonTests.test_stopProcessAlreadyStopped\  s7     	55'*$''--e45r(   c                 >   g }| j                  t        j                  |j                         t        j                  |j                         | j
                  j                  ddg       | j
                  j                          | j                  j                  d       | j                  d| j
                  j                         | j                  j                  | j
                  j                         | j
                  j                  d   j                  d       | j                  t        |      d       |d   d   }|d   d   }|d   d   }|d   d   }| j                  |d	       | j                  |d
       | j                  |d       | j                  |d       y)zS
        Getting a complete output line on stdout generates a log message.
        rV   r      hello world!
r   log_namespacestreamtagline%twisted.runner.procmon.ProcessMonitorstdouthello world!N)
addCleanupr   removeObserverrE   addObserverrP   r\   rp   r   rq   r^   ro   rS   outReceivedassertEqualsr   r   events	namespacer   r   r   s         r&   test_outputReceivedCompleteLinez,ProcmonTests.test_outputReceivedCompleteLinee  K    *996==I&&v}}555'*QeTWW../TWW../% ,,->?#f+q)1Io.	8$Qiay )%LM&(+#u%$/r(   c                 >   g }| j                  t        j                  |j                         t        j                  |j                         | j
                  j                  ddg       | j
                  j                          | j                  j                  d       | j                  d| j
                  j                         | j                  j                  | j
                  j                         | j
                  j                  d   j                  d       | j                  t        |      d       |d   d   }|d   d   }|d   d   }|d   d   }| j                  |d	       | j                  |d
       | j                  |d       | j                  |d       y)zS
        Getting a complete output line on stderr generates a log message.
        rV   r   r   r   r   r   r   r   r   stderrr   N)r   r   r   rE   r   rP   r\   rp   r   rq   r^   ro   rS   errReceivedr   r   r   s         r&   !test_ouputReceivedCompleteErrLinez.ProcmonTests.test_ouputReceivedCompleteErrLine  r   r(   c                 B   g }| j                  t        j                  |j                         t        j                  |j                         | j
                  j                  ddg       | j
                  j                          | j                  j                  d       | j                  d| j
                  j                         | j                  j                  | j
                  j                         | j
                  j                  d   j                  d       | j                  t        |      d       |d   }|d   }|d   }|d   }|d   }| j                  |d	       | j                  |d
       | j                  |d       | j                  |t!        d             y)zN
        Getting invalid UTF-8 results in the repr of the raw message
        rV   r   s   hello world!
r   r   r   r   r   r   r   s   hello world!N)r   r   r   rE   r   rP   r\   rp   r   rq   r^   ro   rS   r   r   r   r]   )r   r   messager   r   r   outputs          r&   *test_outputReceivedCompleteLineInvalidUTF8z7ProcmonTests.test_outputReceivedCompleteLineInvalidUTF8  sH    *996==I&&v}}555'*QeTWW../TWW../% ,,-BC#f+q))O,	"en)%LM&(+#u%&$':";<r(   c                    g }| j                  t        j                  |j                         t        j                  |j                         | j
                  j                  ddg       | j
                  j                          | j                  j                  d       | j                  d| j
                  j                         | j                  j                  | j
                  j                         | j
                  j                  d   j                  d       | j                  t        |      d       | j
                  j                  d   j!                  t#        t%        d                   | j                  t        |      d       |d   d   }|d   d   }|d   d   }|d   d   }| j                  |d	       | j                  |d
       | j                  |d       | j                  |d       y)zM
        Getting partial line results in no events until process end
        rV   r   s   hello world!r   r   r   r   r   r   r   r   N)r   r   r   rE   r   rP   r\   rp   r   rq   r^   ro   rS   r   r   r   r0   r	   r   r   s         r&   test_outputReceivedPartialLinez+ProcmonTests.test_outputReceivedPartialLine  s    *996==I&&v}}555'*QeTWW../TWW../% ,,_=#f+q)% --gk!n.EF#f+q)1Io.	8$Qiay )%LM&(+#u%$/r(   c                    | j                   j                  ddg       | j                   j                          | j                  j	                  d       | j                  d| j                   j                         | j                  j	                  | j                   j                         | j                   j                  d   j                  t        t        d                   | j                  d| j                   j                         | j                  j	                  d       | j                  d| j                   j                         y)z
        L{ProcessMonitor.connectionLost} should immediately restart a process
        if it has been running longer than L{ProcessMonitor.threshold} seconds.
        rV   r   N)rP   r\   rp   r   rq   r^   ro   rS   r0   r	   r   re   rB   s    r&   #test_connectionLostLongLivedProcessz0ProcmonTests.test_connectionLostLongLivedProcess  s    
 	55'*QeTWW../TWW../% --gk!n.EF 1 12QeTWW../r(   c                    | j                   j                  ddg       | j                   j                          | j                  j	                  d       | j                   j                  d       | j                  d| j                   j                         | j                   j                  d   }| j                  |j                                | j                  j	                  | j                   j                  d   j                  j                         | j                  |j                                | j                  d| j                   j                         y)z
        L{ProcessMonitor.connectionLost} cancels a scheduled process killer and
        deletes the DelayedCall from the L{ProcessMonitor.murder} list.
        rV   r   N)rP   r\   rp   r   rq   r   r^   murder
assertTrueactivero   r   r-   assertFalsere   )r   delayedCalls     r&   test_connectionLostMurderCancelz,ProcmonTests.test_connectionLostMurderCancel  s    
 	55'*QE"eTWW^^,ggnnU+**,-TWW..u5??QQR++-./r(   c                    | j                   j                          | j                   j                  ddg       | j                  d| j                   j                         | j                   j                  d   j
                  j                  d       | j                  j                  | j                   j                  d   j
                  j                         | j                  d| j                   j                         y)z
        L{ProcessMonitor.connectionLost} removes the corresponding
        ProcessProtocol instance from the L{ProcessMonitor.protocols} list.
        rV   r,   N)rP   rp   r\   r^   ro   r   r6   r   rq   r-   re   rB   s    r&   #test_connectionLostProtocolDeletionz0ProcmonTests.test_connectionLostProtocolDeletion  s    
 	55'*eTWW../% **88@TWW..u5??QQR 1 12r(   c                    d| j                   _        d| j                   _        | j                   j                          | j                   j	                  ddg       | j                  | j                   j                  d   | j                   j                         | j                  j                  | j                   j                  dz
         | j                   j                  d   j                  t        t        d                   | j                  | j                   j                  d   | j                   j                         y)z}
        L{ProcessMonitor.connectionLost} will wait at least minRestartDelay s
        and at most maxRestartDelay s
        rN      rV   r   r   N)rP   rQ   rR   rp   r\   ri   r4   r   rq   rS   ro   r0   r	   r   rB   s    r&   %test_connectionLostMinMaxRestartDelayz2ProcmonTests.test_connectionLostMinMaxRestartDelay	  s    
 #$"#55'*u-tww/F/FGTWW..23% --gk!n.EFu-tww/F/FGr(   c                    | j                   j                          | j                   j                  ddg       | j                  j	                  | j                   j
                  dz
         | j                  d| j                   j                         | j                  | j                   j                  d   | j                   j                         | j                   j                  d   j                  t        t        d                   | j                  | j                   j                  d   | j                   j                  dz         y)z|
        L{ProcessMonitor.connectionLost} doubles the restart delay each time
        the process dies too quickly.
        rV   r   r   rN   N)rP   rp   r\   r   rq   rS   r^   ro   ri   r4   rQ   r0   r	   r   rB   s    r&   &test_connectionLostBackoffDelayDoublesz3ProcmonTests.test_connectionLostBackoffDelayDoubles  s    
 	55'*TWW..23eTWW../u-tww/F/FG% --gk!n.EFu-tww/F/F/JKr(   c                     | j                   j                  ddg       | j                   j                          | j                  j	                  d       | j                  d| j                   j                         y)zP
        L{ProcessMonitor.startService} starts all monitored processes.
        rV   r   N)rP   r\   rp   r   rq   r^   ro   rB   s    r&   test_startServicezProcmonTests.test_startService'  sT     	55'*QeTWW../r(   c                    | j                   j                  ddg       | j                   j                  ddg       | j                   j                          | j                  j	                  | j                   j
                         | j                  d| j                   j                         | j                  d| j                   j                         | j                  j	                  d       | j                   j                          | j                  j	                  | j                   j                  dz          | j                  i | j                   j                         y)zT
        L{ProcessMonitor.stopService} should stop all monitored processes.
        rV   barr   N)rP   r\   rp   r   rq   rS   r^   ro   stopServicer   ri   rB   s    r&   test_stopServicezProcmonTests.test_stopService2  s     	55'*55'*TWW../eTWW../eTWW../Q 	TWW--12TWW../r(   c                    | j                   j                  ddg       | j                   j                          | j                  j	                  d       | j                   j                          | j                  j	                  d       t        | j                  j                        }|j                         }| j                  |g        | j                  |j                         y)zR
        L{ProcessMonitor.restartAll} succeeds when there is one process.
        rV   r   N)rP   r\   rp   r   rq   
restartAllrr   rA   popr   r   r.   )r   rh   	myProcesss      r&   !test_restartAllRestartsOneProcessz.ProcmonTests.test_restartAllRestartsOneProcessH  s     	55'*Q 	Q667	MMO	)R()--(r(   c                    | j                   j                  ddg       | j                   j                          | j                  j	                  | j                   j
                         | j                  d| j                   j                         | j                  j	                  d       | j                   j                  d   j                  t        t        d                   | j                  | j                   j                  d   j                                | j                   j                          | j                  | j                   j                  d   j                                y)ze
        L{ProcessMonitor.stopService} should cancel any scheduled process
        restarts.
        rV   r   r   N)rP   r\   rp   r   rq   rS   r^   ro   r0   r	   r   r   restartr   r   r   rB   s    r&   test_stopServiceCancelRestartsz+ProcmonTests.test_stopServiceCancelRestartsX  s    
 	55'*TWW../eTWW../Q% --gk!n.EF.5578/6689r(   c                    d| j                   _        d| j                   _        | j                   j                          | j                   j	                  ddg       | j
                  j                  d       | j                   j                  d       | j
                  j                  d       | j                   j                          | j
                  j                  d       | j                  | j                   j                  i        y)ze
        L{ProcessMonitor.stopService} should cancel all scheduled process
        restarts.
           rV   r      N)rP   rS   rQ   rp   r\   r   rq   r   r   ri   ro   rB   s    r&   (test_stopServiceCleanupScheduledRestartsz5ProcmonTests.test_stopServiceCleanupScheduledRestartsl  s    
 "#55'*QE"QQ 	**B/r(   N)$r9   r:   r;   r<   rT   ra   rf   rk   rm   rt   rx   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r=   r(   r&   rK   rK      s    +
.
=
B
	QN	4B
97AM<M:@60606=80:0(0*
3H L	00,) :(0r(   rK   c                   (    e Zd ZdZd Zd Zd Zd Zy)DeprecationTestszQ
    Tests that check functionality that should be deprecated is deprecated.
    c                 X    t               | _        t        | j                        | _        y)z5
        Create reactor and process monitor.
        rM   N)r?   r   r   rP   rB   s    r&   rT   zDeprecationTests.setUp  s     +, 6r(   c                 T   | j                   j                  ddg       | j                   j                  }| j                  t	        |      d       | j                         }d}|D ]%  }| j                  |d   t               d|d   v s$d}' | j                  |dt        |              y	)
a   
        _Process.toTuple is deprecated.

        When getting the deprecated processes property, the actual
        data (kept in the class _Process) is converted to a tuple --
        which produces a DeprecationWarning per process so converted.
        rV   r   FcategorytoTupler   Tzno tuple deprecation found:N)
rP   r\   rh   r   r   flushWarningsassertIsDeprecationWarningr   r]   )r   myprocesseswarningsfoundToTuplewarnings        r&   test_toTuplezDeprecationTests.test_toTuple  s     	55'*gg''#k*A.%%' 	$GMM'*-/ABGI..#	$ 	(CDNCS&TUr(   c                     | j                   j                  }| j                  |i        | j                         }|j	                  d      }| j                  |d   t               | j                  |g        y)a  
        Accessing L{ProcessMonitor.processes} results in deprecation warning

        Even when there are no processes, and thus no process is converted
        to a tuple, accessing the L{ProcessMonitor.processes} property
        should generate its own DeprecationWarning.
        r   r   N)rP   rh   r   r   r   r   r   )r   myProcessesr   firsts       r&   test_processeszDeprecationTests.test_processes  sb     gg''+r*%%'QeJ');<(B'r(   c                     t        j                  | j                         | j                         }|D ]  }| j	                  |d   t
                y)zO
        Pickling an L{ProcessMonitor} results in deprecation warnings
        r   N)pickledumpsrP   r   r   r   )r   r   r   s      r&   test_getstatezDeprecationTests.test_getstate  sG     	TWW%%' 	CGMM'*-/AB	Cr(   N)r9   r:   r;   r<   rT   r   r   r   r=   r(   r&   r   r     s    7V&(Cr(   r   )r<   r   twisted.internet.errorr   r   r   twisted.internet.taskr   twisted.internet.testingr   twisted.loggerr   twisted.python.failurer	   twisted.runner.procmonr
   r   twisted.trialr   r   r?   TestCaserK   SynchronousTestCaser   r=   r(   r&   <module>r      sn     W W ' 2 - * B "GD GDT,- ,^v08$$ v0r6Cx33 6Cr(   