Commit 7fb02632 authored by Alexandre Boeglin's avatar Alexandre Boeglin

PortalTestCase.setUp is overloaded so that it dos not execute beforeSetUp and

afterSetUp from the original tests, which would write to the FileStorage when
--save is enabled.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12954 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 60a32b52
...@@ -644,6 +644,20 @@ from unittest import _makeLoader, TestSuite ...@@ -644,6 +644,20 @@ from unittest import _makeLoader, TestSuite
def dummy_makeSuite(testCaseClass, prefix='dummy_test', sortUsing=cmp, suiteClass=TestSuite): def dummy_makeSuite(testCaseClass, prefix='dummy_test', sortUsing=cmp, suiteClass=TestSuite):
return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromTestCase(testCaseClass) return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromTestCase(testCaseClass)
def dummy_setUp(self):
'''
This one is overloaded so that it dos not execute beforeSetUp and afterSetUp
from the original tests, which would write to the FileStorage when --save is
enabled
'''
try:
self.app = self._app()
self.portal = self._portal()
self._setup()
except:
self._clear()
raise
def optimize(): def optimize():
'''Significantly reduces portal creation time.''' '''Significantly reduces portal creation time.'''
def __init__(self, text): def __init__(self, text):
......
...@@ -169,9 +169,13 @@ def runUnitTestList(test_list) : ...@@ -169,9 +169,13 @@ def runUnitTestList(test_list) :
sys.path.insert(0, tests_framework_home) sys.path.insert(0, tests_framework_home)
# override unittest.makeSuite to skip all tests in save mode # override unittest.makeSuite to skip all tests in save mode
# and PortalTestCase.setUp to skip beforeSetUp and afterSetUp
if os.environ.get('erp5_save_data_fs'): if os.environ.get('erp5_save_data_fs'):
from Products.ERP5Type.tests.ERP5TypeTestCase import dummy_makeSuite from Products.ERP5Type.tests.ERP5TypeTestCase import \
dummy_makeSuite, dummy_setUp
from Testing.ZopeTestCase.PortalTestCase import PortalTestCase
unittest.makeSuite = dummy_makeSuite unittest.makeSuite = dummy_makeSuite
PortalTestCase.setUp = dummy_setUp
filtered_tests_class_names = 0 filtered_tests_class_names = 0
for test in test_list: for test in test_list:
......
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