[Zope3-checkins] SVN: Zope3/trunk/ Fixed test_directives.py in zope.sendmail to write to a temporary directory rather than the source tree.

Brian Sutherland jinty at web.de
Tue Mar 6 12:27:19 EST 2007


Log message for revision 73013:
  Fixed test_directives.py in zope.sendmail to write to a temporary directory rather than the source tree.

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/sendmail/tests/mail.zcml
  U   Zope3/trunk/src/zope/sendmail/tests/test_directives.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2007-03-06 17:16:44 UTC (rev 73012)
+++ Zope3/trunk/doc/CHANGES.txt	2007-03-06 17:27:18 UTC (rev 73013)
@@ -368,6 +368,9 @@
       - Fixed classregistry.txt in zope.app.apidoc to write to a temporary
         directory rather than the source tree.
 
+      - Fixed test_directives.py in zope.sendmail to write to a temporary
+        directory rather than the source tree.
+
     Much thanks to everyone who contributed to this release:
 
       Jim Fulton, Dmitry Vasiliev, Martijn Faassen, Christian Theune, Wolfgang

Modified: Zope3/trunk/src/zope/sendmail/tests/mail.zcml
===================================================================
--- Zope3/trunk/src/zope/sendmail/tests/mail.zcml	2007-03-06 17:16:44 UTC (rev 73012)
+++ Zope3/trunk/src/zope/sendmail/tests/mail.zcml	2007-03-06 17:27:18 UTC (rev 73013)
@@ -5,7 +5,7 @@
 
   <mail:queuedDelivery 
       name="Mail"
-      queuePath="./mailbox"
+      queuePath="path/to/tmp/mailbox"
       mailer="test.smtp"
       permission="zope.Public" />
   

Modified: Zope3/trunk/src/zope/sendmail/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/sendmail/tests/test_directives.py	2007-03-06 17:16:44 UTC (rev 73012)
+++ Zope3/trunk/src/zope/sendmail/tests/test_directives.py	2007-03-06 17:27:18 UTC (rev 73013)
@@ -19,6 +19,7 @@
 import shutil
 import unittest
 import threading
+import tempfile
 import time
 
 import zope.component
@@ -51,9 +52,9 @@
 
 class DirectivesTest(PlacelessSetup, unittest.TestCase):
 
-    mailbox = os.path.join(os.path.dirname(__file__), 'mailbox')
+    def setUp(self):
+        self.mailbox = os.path.join(tempfile.mkdtemp(), "mailbox")
 
-    def setUp(self):
         super(DirectivesTest, self).setUp()
         self.testMailer = Mailer()
 
@@ -61,7 +62,12 @@
         gsm.registerUtility(Mailer(), IMailer, "test.smtp")
         gsm.registerUtility(self.testMailer, IMailer, "test.mailer")
 
-        self.context = xmlconfig.file("mail.zcml", zope.sendmail.tests)
+        here = os.path.dirname(__file__)
+        zcmlfile = open(os.path.join(here, "mail.zcml"), 'r')
+        zcml = zcmlfile.read()
+        zcmlfile.close()
+
+        self.context = xmlconfig.string(zcml.replace('path/to/tmp/mailbox', self.mailbox))
         self.orig_maildir = delivery.Maildir
         delivery.Maildir = MaildirStub
 



More information about the Zope3-Checkins mailing list