[Python-checkins] python/dist/src/Lib/test test_signal.py, 1.14, 1.15

mwh at users.sourceforge.net mwh at users.sourceforge.net
Fri Jun 11 14:09:31 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12773

Modified Files:
	test_signal.py 
Log Message:
lightly modified version of my patch
[ 971323 ] make test_signal less annoying
after some comments on IRC from a highly opinionated australian who 
wishes to remain anonymous.


Index: test_signal.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_signal.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** test_signal.py	24 Apr 2003 16:02:52 -0000	1.14
--- test_signal.py	11 Jun 2004 18:09:28 -0000	1.15
***************
*** 18,26 ****
          set %(x)s
          sleep 2
!         kill -5 %(pid)d
          sleep 2
!         kill -2 %(pid)d
          sleep 2
!         kill -3 %(pid)d
   ) &
  """ % vars()
--- 18,26 ----
          set %(x)s
          sleep 2
!         kill -HUP %(pid)d
          sleep 2
!         kill -USR1 %(pid)d
          sleep 2
!         kill -USR2 %(pid)d
   ) &
  """ % vars()
***************
*** 38,65 ****
  
  signal.alarm(20)                        # Entire test lasts at most 20 sec.
! signal.signal(5, handlerA)
! signal.signal(2, handlerB)
! signal.signal(3, signal.SIG_IGN)
! signal.signal(signal.SIGALRM, signal.default_int_handler)
  
! os.system(script)
  
! print "starting pause() loop..."
  
! try:
!     while 1:
!         if verbose:
!             print "call pause()..."
!         try:
!             signal.pause()
!             if verbose:
!                 print "pause() returned"
!         except HandlerBCalled:
              if verbose:
!                 print "HandlerBCalled exception caught"
!             else:
!                 pass
  
! except KeyboardInterrupt:
!     if verbose:
!         print "KeyboardInterrupt (assume the alarm() went off)"
--- 38,72 ----
  
  signal.alarm(20)                        # Entire test lasts at most 20 sec.
! hup = signal.signal(signal.SIGHUP, handlerA)
! usr1 = signal.signal(signal.SIGUSR1, handlerB)
! usr2 = signal.signal(signal.SIGUSR2, signal.SIG_IGN)
! alrm = signal.signal(signal.SIGALRM, signal.default_int_handler)
  
! try:
!     os.system(script)
  
!     print "starting pause() loop..."
  
!     try:
!         while 1:
              if verbose:
!                 print "call pause()..."
!             try:
!                 signal.pause()
!                 if verbose:
!                     print "pause() returned"
!             except HandlerBCalled:
!                 if verbose:
!                     print "HandlerBCalled exception caught"
!                 else:
!                     pass
  
!     except KeyboardInterrupt:
!         if verbose:
!             print "KeyboardInterrupt (assume the alarm() went off)"
! 
! finally:
!     signal.signal(signal.SIGHUP, hup)
!     signal.signal(signal.SIGUSR1, usr1)
!     signal.signal(signal.SIGUSR2, usr2)
!     signal.signal(signal.SIGALRM, alrm)




More information about the Python-checkins mailing list