summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Vagelpohl <jens@netz.ooo>2005-09-10 10:53:50 +0000
committerJens Vagelpohl <jens@netz.ooo>2005-09-10 10:53:50 +0000
commit9195f11c2ce184dc49be64c6cad4137e6f38615d (patch)
tree633b46268985e3e2d64b4a8517b8d3fc24ec7866
parentb3022ab9cf82b557d7f4ce8201adae5b75871da2 (diff)
downloadViewsManager-9195f11c2ce184dc49be64c6cad4137e6f38615d.zip
ViewsManager-9195f11c2ce184dc49be64c6cad4137e6f38615d.tar.gz
- To prevent DeprecationWarnings under Zope 2.8 and up, change the
way the tests modules initialize Zope for testing (http://www.dataflake.org/tracker/issue_00467, thanks to Timothy Heap) - To prevent ZODB-related deprecation warnings due to the changes in how a transaction is fetched and manipulated in code, more backwards-compatible import changes have been added. The tests now run on Zope 2.7.x and 2.8.x without warnings.
-rw-r--r--CHANGES.txt12
-rw-r--r--MaildropHost.py10
-rw-r--r--tests/test_Email.py23
-rw-r--r--tests/test_MaildropHost.py7
4 files changed, 44 insertions, 8 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 951417f..4e0a89b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,6 @@
MaildropHost version and change information
- After 1.12
+ 1.13 (2005/09/10)
* Bugs fixed
@@ -12,6 +12,16 @@ MaildropHost version and change information
the spool directory were emails and which were unrelated
artifacts.
+ - To prevent DeprecationWarnings under Zope 2.8 and up, change the
+ way the tests modules initialize Zope for testing
+ (http://www.dataflake.org/tracker/issue_00467, thanks to
+ Timothy Heap)
+
+ - To prevent ZODB-related deprecation warnings due to the changes
+ in how a transaction is fetched and manipulated in code, more
+ backwards-compatible import changes have been added. The tests
+ now run on Zope 2.7.x and 2.8.x without warnings.
+
1.12
diff --git a/MaildropHost.py b/MaildropHost.py
index 26ba152..4590855 100644
--- a/MaildropHost.py
+++ b/MaildropHost.py
@@ -18,6 +18,16 @@ from Globals import DTMLFile, InitializeClass, package_home
from AccessControl import ClassSecurityInfo
from Products.MailHost.MailHost import MailHost
+# BBB - Zope 2.8 and on use "transaction.get" instead of get_transaction
+try:
+ import transaction
+ get_transaction = transaction.get
+ begin_transaction = transaction.manager.begin
+except ImportError:
+ # Zope 2.7 and earlier. No need to do anything, get_transaction is
+ # stuffed into __builtins__ in those Zope versions.
+ pass
+
# MaildropHost package imports
from config import MAILDROP_HOME
try:
diff --git a/tests/test_Email.py b/tests/test_Email.py
index 1ffd717..308fd64 100644
--- a/tests/test_Email.py
+++ b/tests/test_Email.py
@@ -16,8 +16,21 @@ from unittest import TestCase, TestSuite, makeSuite, main
# Zope imports
import Testing
-import Zope
-Zope.startup()
+try:
+ import Zope2
+except ImportError: # for Zope 2.7
+ import Zope as Zope2
+Zope2.startup()
+
+# BBB - Zope 2.8 and on use "transaction.get" instead of get_transaction
+try:
+ import transaction
+ get_transaction = transaction.get
+ begin_transaction = transaction.manager.begin
+except ImportError:
+ # Zope 2.7 and earlier. No need to do anything, get_transaction is
+ # stuffed into __builtins__ in those Zope versions.
+ begin_transaction = get_transaction().begin
# MaildropHost imports
from Products.MaildropHost.MaildropHost import Email
@@ -115,7 +128,7 @@ class TransactionalEmailTests(EmailTestBase):
def test_send_transaction(self):
# First of all, make sure we are in a clean transaction
- get_transaction().begin()
+ begin_transaction()
self.assertEquals(len(_listDir(MAILDROP_SPOOL)), 0)
email1 = self._makeAndSend()
@@ -141,7 +154,7 @@ class TransactionalEmailTests(EmailTestBase):
def test_send_subtransaction(self):
# First of all, make sure we are in a clean transaction
- get_transaction().begin()
+ begin_transaction()
self.assertEquals(len(_listDir(MAILDROP_SPOOL)), 0)
email1 = self._makeAndSend()
@@ -161,7 +174,7 @@ class TransactionalEmailTests(EmailTestBase):
def test_send_transaction_abort(self):
# First of all, make sure we are in a clean transaction
- get_transaction().begin()
+ begin_transaction()
self.assertEquals(len(_listDir(MAILDROP_SPOOL)), 0)
email1 = self._makeAndSend()
diff --git a/tests/test_MaildropHost.py b/tests/test_MaildropHost.py
index 197268c..5457979 100644
--- a/tests/test_MaildropHost.py
+++ b/tests/test_MaildropHost.py
@@ -13,8 +13,11 @@ from unittest import TestCase, TestSuite, makeSuite, main
# Zope imports
import Testing
-import Zope
-Zope.startup()
+try:
+ import Zope2
+except ImportError: # for Zope 2.7
+ import Zope as Zope2
+Zope2.startup()
# MaildropHost package imports
from Products.MaildropHost.MaildropHost import MaildropHost