[Zope-Checkins] SVN: Zope/trunk/lib/python/Testing/ZopeTestCase/
Protect against setNumberOfThreads disappearing after first use...
Stefan H. Holek
stefan at epy.co.at
Thu Mar 15 09:29:18 EDT 2007
Log message for revision 73190:
Protect against setNumberOfThreads disappearing after first use...
Changed:
U Zope/trunk/lib/python/Testing/ZopeTestCase/threadutils.py
U Zope/trunk/lib/python/Testing/ZopeTestCase/utils.py
-=-
Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/threadutils.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/threadutils.py 2007-03-15 13:18:45 UTC (rev 73189)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/threadutils.py 2007-03-15 13:29:18 UTC (rev 73190)
@@ -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/trunk/lib/python/Testing/ZopeTestCase/utils.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/utils.py 2007-03-15 13:18:45 UTC (rev 73189)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/utils.py 2007-03-15 13:29:18 UTC (rev 73190)
@@ -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 Zope-Checkins
mailing list