[Python-checkins] python/dist/src/Lib/test test_capi.py,1.4,1.5

mhammond@users.sourceforge.net mhammond@users.sourceforge.net
Sat, 19 Apr 2003 08:42:19 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv30725/Lib/test

Modified Files:
	test_capi.py 
Log Message:
New PyGILState_ API - implements pep 311, from patch 684256.


Index: test_capi.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_capi.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** test_capi.py	23 Jul 2002 19:03:45 -0000	1.4
--- test_capi.py	19 Apr 2003 15:41:46 -0000	1.5
***************
*** 15,16 ****
--- 15,45 ----
          except _testcapi.error:
              raise test_support.TestFailed, sys.exc_info()[1]
+ 
+ # some extra thread-state tests driven via _testcapi
+ def TestThreadState():
+     import thread
+     import time
+ 
+     if test_support.verbose:
+         print "auto-thread-state"
+ 
+     idents = []
+ 
+     def callback():
+         idents.append(thread.get_ident())
+     
+     _testcapi._test_thread_state(callback)
+     time.sleep(1)
+     # Check our main thread is in the list exactly 3 times.
+     if idents.count(thread.get_ident()) != 3:
+         raise test_support.TestFailed, \
+               "Couldn't find main thread correctly in the list"
+ 
+ try:
+     _testcapi._test_thread_state
+     have_thread_state = True
+ except AttributeError:
+     have_thread_state = False
+     
+ if have_thread_state:
+     TestThreadState()