Commit 8b26e569 authored by Jérome Perrin's avatar Jérome Perrin

it's still required to monkey patch unittest.makeSuite, because it's used in

test_suite function in test cases


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15970 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5898f5f8
...@@ -701,6 +701,11 @@ def setupERP5Site( business_template_list=(), ...@@ -701,6 +701,11 @@ def setupERP5Site( business_template_list=(),
% title) # run_unit_test depends on this string. % title) # run_unit_test depends on this string.
raise raise
from unittest import _makeLoader, TestSuite
def dummy_makeSuite(testCaseClass, prefix='dummy_test', sortUsing=cmp, suiteClass=TestSuite):
return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromTestCase(testCaseClass)
def dummy_setUp(self): def dummy_setUp(self):
''' '''
This one is overloaded so that it dos not execute beforeSetUp and afterSetUp This one is overloaded so that it dos not execute beforeSetUp and afterSetUp
......
...@@ -232,12 +232,15 @@ def runUnitTestList(test_list) : ...@@ -232,12 +232,15 @@ def runUnitTestList(test_list) :
save = 0 save = 0
# pass save=1 to test loader to skip all tests in save mode # pass save=1 to test loader to skip all tests in save mode
# and monkeypatch PortalTestCase.setUp to skip beforeSetUp and afterSetUp # and monkeypatch PortalTestCase.setUp to skip beforeSetUp and afterSetUp.
# Also patch unittest.makeSuite, as it's used in test_suite function in
# test cases.
if os.environ.get('erp5_save_data_fs'): if os.environ.get('erp5_save_data_fs'):
from Products.ERP5Type.tests.ERP5TypeTestCase import \ from Products.ERP5Type.tests.ERP5TypeTestCase import \
dummy_setUp, dummy_tearDown dummy_makeSuite, dummy_setUp, dummy_tearDown
save = 1 save = 1
from Testing.ZopeTestCase.PortalTestCase import PortalTestCase from Testing.ZopeTestCase.PortalTestCase import PortalTestCase
unittest.makeSuite = dummy_makeSuite
PortalTestCase.setUp = dummy_setUp PortalTestCase.setUp = dummy_setUp
PortalTestCase.tearDown = dummy_tearDown PortalTestCase.tearDown = dummy_tearDown
......
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