[Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/ Merged trunk r73189:73190 into 2.8 branch.

Stefan H. Holek stefan at epy.co.at
Mon Apr 9 10:33:02 EDT 2007


Log message for revision 74045:
  Merged trunk r73189:73190 into 2.8 branch.
  
  Protect against setNumberOfThreads disappearing after first use.
  

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/threadutils.py
  U   Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/utils.py

-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/threadutils.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/threadutils.py	2007-04-09 14:20:09 UTC (rev 74044)
+++ Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/threadutils.py	2007-04-09 14:33:01 UTC (rev 74045)
@@ -13,7 +13,7 @@
 """Parts of ZServer support are in this module so they can
 be imported more selectively.
 
-$Id: threadutils.py,v 1.6 2004/08/19 15:31:26 shh42 Exp $
+$Id$
 """
 
 from threading import Thread
@@ -22,6 +22,15 @@
 dummyLOG = StringIO()
 
 
+def setNumberOfThreads(number_of_threads):
+    '''Sets number of ZServer threads.'''
+    try:
+        from ZServer.PubCore import setNumberOfThreads
+        setNumberOfThreads(number_of_threads)
+    except ImportError:
+        pass
+
+
 def zserverRunner(host, port, log=None):
     '''Runs an HTTP ZServer on host:port.'''
     from ZServer import logger, asyncore

Modified: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/utils.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/utils.py	2007-04-09 14:20:09 UTC (rev 74044)
+++ Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/utils.py	2007-04-09 14:33:01 UTC (rev 74045)
@@ -115,7 +115,7 @@
     if _Z2HOST is None:
         _Z2HOST = '127.0.0.1'
         _Z2PORT = random.choice(range(55000, 55500))
-        from ZServer import setNumberOfThreads
+        from threadutils import setNumberOfThreads
         setNumberOfThreads(number_of_threads)
         from threadutils import QuietThread, zserverRunner
         t = QuietThread(target=zserverRunner, args=(_Z2HOST, _Z2PORT, log))



More information about the Checkins mailing list