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

Share method in module.

parent e4437488
......@@ -9,7 +9,7 @@ import transaction
import functools
from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin
testSlapOSMixin, withAbort
import os
import tempfile
from DateTime import DateTime
......@@ -1175,15 +1175,6 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
self.assertEqual(request_time_2, validated_line_2.getStartDate())
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:
def __init__(self, outfile, method, to_return=None):
self.outfile = outfile
......
......@@ -6,20 +6,9 @@
##############################################################################
from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin
testSlapOSMixin, withAbort
from DateTime import DateTime
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):
@withAbort
......
......@@ -30,8 +30,18 @@ import random
import transaction
import unittest
import Products.Vifib.tests.VifibMixin
import functools
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):
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