SVN: ZODB/trunk/src/ZEO/tests/testConnection.py Added hack to use zope.testing.doctest to allow running tests

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20100910160327.DA8AA941E4__35830.1808512353$1284134615$gmane$org@cvs.zope.org>
Log message for revision 116295:
  Added hack to use zope.testing.doctest to allow running tests
  repeatedly.
  
  Added additional debugging info to try to understand what's going on
  on a rare bot test failure that I can't reproduce.
  

Changed:
  U   ZODB/trunk/src/ZEO/tests/testConnection.py

-=-
Modified: ZODB/trunk/src/ZEO/tests/testConnection.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testConnection.py	2010-09-10 15:43:25 UTC (rev 116294)
+++ ZODB/trunk/src/ZEO/tests/testConnection.py	2010-09-10 16:03:27 UTC (rev 116295)
@@ -21,7 +21,11 @@
 
 from ZEO.tests import ConnectionTests, InvalidationTests
 from zope.testing import setupstack
-import doctest
+import os
+if os.environ.get('USE_ZOPE_TESTING_DOCTEST'):
+    from zope.testing import doctest
+else:
+    import doctest
 import unittest
 import ZEO.tests.forker
 import ZEO.tests.testMonitor
@@ -191,6 +195,8 @@
     >>> import zope.testing.loggingsupport, logging
     >>> handler = zope.testing.loggingsupport.InstalledHandler(
     ...    'ZEO', level=logging.ERROR)
+    >>> debughandler = zope.testing.loggingsupport.InstalledHandler(
+    ...    'ZEO', level=logging.DEBUG)
 
     >>> bad = False
     >>> try:
@@ -218,6 +224,11 @@
 
     >>> if bad:
     ...    print open('server-%s.log' % addr[1]).read()
+    ...    print 'client debug log'
+    ...    for record in debughandler.records:
+    ...        print record.name, record.levelname
+    ...        print debughandler.format(record)
+    >>> debughandler.uninstall()
 
     >>> thread.isAlive()
     False
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.