[Zope3-checkins] CVS: Zope3/src/zope/app/mail/tests - test_directives.py:1.8

Jim Fulton jim at zope.com
Mon Sep 22 18:37:25 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/mail/tests
In directory cvs.zope.org:/tmp/cvs-serv31318/src/zope/app/mail/tests

Modified Files:
	test_directives.py 
Log Message:
Added logic to stop threads started by the tests.


=== Zope3/src/zope/app/mail/tests/test_directives.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/mail/tests/test_directives.py:1.7	Sun Aug 17 02:07:17 2003
+++ Zope3/src/zope/app/mail/tests/test_directives.py	Mon Sep 22 18:37:25 2003
@@ -17,10 +17,13 @@
 """
 import os
 import unittest
+import threading
+import time
 
 from zope.app.component.metaconfigure import managerHandler, provideInterface
 from zope.app.interfaces.mail import IMailService, ISMTPMailer, ISendmailMailer
 from zope.app.mail.metaconfigure import provideMailer, queryMailer
+from zope.app.mail.service import QueueProcessorThread
 from zope.app.mail import service
 from zope.component import getService
 from zope.component.tests.placelesssetup import PlacelessSetup
@@ -54,9 +57,21 @@
         self.context = xmlconfig.file("mail.zcml", zope.app.mail.tests)
         self.orig_maildir = service.Maildir
         service.Maildir = MaildirStub
+        
 
     def tearDown(self):
         service.Maildir = self.orig_maildir
+
+        # Tear down the mail queue processor thread.
+        # Give the other thread a chance to start:
+        time.sleep(0.001)
+        threads = list(threading.enumerate())
+        for thread in threads:
+            if isinstance(thread, QueueProcessorThread):
+                thread.stop()
+                thread.join()
+                
+        
 
     def testQueuedService(self):
         service = getService(None, 'Mail')




More information about the Zope3-Checkins mailing list