[Python-checkins] python/dist/src/Lib/test test_threadsignals.py, 1.5, 1.6

mwh at users.sourceforge.net mwh at users.sourceforge.net
Wed Aug 4 16:22:59 CEST 2004


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

Modified Files:
	test_threadsignals.py 
Log Message:
To ever run this test "you must import TestSkipped" from the right
place! (can that please be it for silly mistakes in this file? :-) I
know I started it, but...).

Also, rearrangements to run repeatedly.


Index: test_threadsignals.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_threadsignals.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test_threadsignals.py	4 Aug 2004 02:36:18 -0000	1.5
--- test_threadsignals.py	4 Aug 2004 14:22:56 -0000	1.6
***************
*** 6,18 ****
  import os
  import sys
! from test import test_support, TestSkipped
  
  if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos':
      raise TestSkipped, "Can't test signal on %s" % sys.platform
  
- signal_blackboard = { signal.SIGUSR1 : {'tripped': 0, 'tripped_by': 0 },
-                       signal.SIGUSR2 : {'tripped': 0, 'tripped_by': 0 },
-                       signal.SIGALRM : {'tripped': 0, 'tripped_by': 0 } }
- 
  process_pid = os.getpid()
  signalled_all=thread.allocate_lock()
--- 6,14 ----
  import os
  import sys
! from test.test_support import run_unittest, TestSkipped
  
  if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos':
      raise TestSkipped, "Can't test signal on %s" % sys.platform
  
  process_pid = os.getpid()
  signalled_all=thread.allocate_lock()
***************
*** 66,69 ****
--- 62,66 ----
          self.assertEqual( signal_blackboard[signal.SIGUSR2]['tripped_by'],
                             thread.get_ident())
+         signalled_all.release()
  
      def spawnSignallingThread(self):
***************
*** 72,78 ****
  
  def test_main():
      oldsigs = registerSignals((handle_signals, handle_signals, handle_signals))
      try:
!         test_support.run_unittest(ThreadSignals)
      finally:
          registerSignals(oldsigs)
--- 69,81 ----
  
  def test_main():
+     global signal_blackboard
+     
+     signal_blackboard = { signal.SIGUSR1 : {'tripped': 0, 'tripped_by': 0 },
+                           signal.SIGUSR2 : {'tripped': 0, 'tripped_by': 0 },
+                           signal.SIGALRM : {'tripped': 0, 'tripped_by': 0 } }
+ 
      oldsigs = registerSignals((handle_signals, handle_signals, handle_signals))
      try:
!         run_unittest(ThreadSignals)
      finally:
          registerSignals(oldsigs)



More information about the Python-checkins mailing list