[Zope3-checkins] SVN: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zope Update the FTP tests to use a Twisted trial method for removing

Michael Kerrin michael.kerrin at openapp.biz
Sun Jan 21 11:41:36 EST 2007


Log message for revision 72162:
  Update the FTP tests to use a Twisted trial method for removing
  any threads left behind by running these tests.
  

Changed:
  U   Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zope_ftp.py
  U   Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zopetrial.py

-=-
Modified: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zope_ftp.py
===================================================================
--- Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zope_ftp.py	2007-01-21 16:36:33 UTC (rev 72161)
+++ Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zope_ftp.py	2007-01-21 16:41:35 UTC (rev 72162)
@@ -65,9 +65,11 @@
 
     def tearDown(self):
         # Twisted trial has a habit of leaving threads lying about when run
-        # from within the Zope test runner - killthreads removes them.
-        import test_zopetrial
-        test_zopetrial.killthreads()
+        # from within the Zope test runner - do_cleanThreads removes them.
+        # The threads don't actaully cause any errors - they just print
+        # out a few extra lines of information when running the tests.
+        from twisted.trial import util
+        util._Janitor.do_cleanThreads()
 
         # Clean up sockets
         self.client.transport.loseConnection()

Modified: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zopetrial.py
===================================================================
--- Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zopetrial.py	2007-01-21 16:36:33 UTC (rev 72161)
+++ Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zopetrial.py	2007-01-21 16:41:35 UTC (rev 72162)
@@ -34,22 +34,6 @@
 
 import zope.testing.testrunner
 
-
-def killthreads():
-    """
-    A lot of tests will start threads which the Zope testrunner complains
-    about. You can use this method to kill off these threads.
-    """
-    from twisted.internet import reactor, interfaces
-    from twisted.python import threadpool
-    if interfaces.IReactorThreads.providedBy(reactor):
-        reactor.suggestThreadPoolSize(0)
-        if reactor.threadpool:
-            reactor.threadpool.stop()
-            reactor.threadpool = None
-            reactor.threadpool = threadpool.ThreadPool(0, 10)
-            reactor.threadpool.start()
-
 orig_configure_logging = zope.testing.testrunner.configure_logging
 
 def setUp(test):



More information about the Zope3-Checkins mailing list