Commit 4ed26f94 authored by Łukasz Nowak's avatar Łukasz Nowak

Share method in module.

parent e4437488
...@@ -9,7 +9,7 @@ import transaction ...@@ -9,7 +9,7 @@ import transaction
import functools import functools
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.SlapOS.tests.testSlapOSMixin import \ from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin testSlapOSMixin, withAbort
import os import os
import tempfile import tempfile
from DateTime import DateTime from DateTime import DateTime
...@@ -1175,15 +1175,6 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin): ...@@ -1175,15 +1175,6 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
self.assertEqual(request_time_2, validated_line_2.getStartDate()) self.assertEqual(request_time_2, validated_line_2.getStartDate())
self.assertEqual(stop_date_2, validated_line_2.getStopDate()) self.assertEqual(stop_date_2, validated_line_2.getStopDate())
def withAbort(func):
@functools.wraps(func)
def wrapped(self, *args, **kwargs):
try:
func(self, *args, **kwargs)
finally:
transaction.abort()
return wrapped
class Simulator: class Simulator:
def __init__(self, outfile, method, to_return=None): def __init__(self, outfile, method, to_return=None):
self.outfile = outfile self.outfile = outfile
......
...@@ -6,20 +6,9 @@ ...@@ -6,20 +6,9 @@
############################################################################## ##############################################################################
from Products.SlapOS.tests.testSlapOSMixin import \ from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin testSlapOSMixin, withAbort
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.DateUtils import addToDate from Products.ERP5Type.DateUtils import addToDate
import transaction
import functools
def withAbort(func):
@functools.wraps(func)
def wrapped(self, *args, **kwargs):
try:
func(self, *args, **kwargs)
finally:
transaction.abort()
return wrapped
class TestDefaultInvoiceTransactionRule(testSlapOSMixin): class TestDefaultInvoiceTransactionRule(testSlapOSMixin):
@withAbort @withAbort
......
...@@ -30,8 +30,18 @@ import random ...@@ -30,8 +30,18 @@ import random
import transaction import transaction
import unittest import unittest
import Products.Vifib.tests.VifibMixin import Products.Vifib.tests.VifibMixin
import functools
from Products.ERP5Type.tests.utils import DummyMailHost from Products.ERP5Type.tests.utils import DummyMailHost
def withAbort(func):
@functools.wraps(func)
def wrapped(self, *args, **kwargs):
try:
func(self, *args, **kwargs)
finally:
transaction.abort()
return wrapped
class testSlapOSMixin(Products.Vifib.tests.VifibMixin.testVifibMixin): class testSlapOSMixin(Products.Vifib.tests.VifibMixin.testVifibMixin):
def _setUpDummyMailHost(self): def _setUpDummyMailHost(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment