Commit 4401cb4f authored by Tatuya Kamada's avatar Tatuya Kamada

Follow python 2.7.

parent ff8dcb0a
...@@ -169,7 +169,6 @@ class ERP5TypeTestReLoader(ERP5TypeTestLoader): ...@@ -169,7 +169,6 @@ class ERP5TypeTestReLoader(ERP5TypeTestLoader):
def runLiveTest(test_list, verbosity=1, stream=None, **kw): def runLiveTest(test_list, verbosity=1, stream=None, **kw):
from Products.ERP5Type.tests.runUnitTest import DebugTestResult from Products.ERP5Type.tests.runUnitTest import DebugTestResult
from Products.ERP5Type.tests import backportUnittest
from StringIO import StringIO from StringIO import StringIO
# Add path of the TestTemplateItem folder of the instance # Add path of the TestTemplateItem folder of the instance
path = kw.get('path', None) path = kw.get('path', None)
...@@ -184,7 +183,7 @@ def runLiveTest(test_list, verbosity=1, stream=None, **kw): ...@@ -184,7 +183,7 @@ def runLiveTest(test_list, verbosity=1, stream=None, **kw):
sys.path.extend(path for path in product_test_list sys.path.extend(path for path in product_test_list
if path not in current_syspath) if path not in current_syspath)
TestRunner = backportUnittest.TextTestRunner TestRunner = unittest.TextTestRunner
if ERP5TypeLiveTestCase not in ERP5TypeTestCase.__bases__: if ERP5TypeLiveTestCase not in ERP5TypeTestCase.__bases__:
ERP5TypeTestCase.__bases__ = ERP5TypeLiveTestCase, ERP5TypeTestCase.__bases__ = ERP5TypeLiveTestCase,
if kw.get('debug', False): if kw.get('debug', False):
......
...@@ -8,7 +8,7 @@ from Testing import ZopeTestCase ...@@ -8,7 +8,7 @@ from Testing import ZopeTestCase
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from zLOG import LOG, ERROR from zLOG import LOG, ERROR
from Products.CMFActivity.Activity.Queue import VALIDATION_ERROR_DELAY from Products.CMFActivity.Activity.Queue import VALIDATION_ERROR_DELAY
from Products.ERP5Type.tests import backportUnittest from Products.ERP5Type.tests.utils import addUserToDeveloperRole
from Products.ERP5Type.tests.utils import createZServer from Products.ERP5Type.tests.utils import createZServer
...@@ -116,7 +116,7 @@ from OFS.Application import Application ...@@ -116,7 +116,7 @@ from OFS.Application import Application
Application._p_resolveConflict = Application_resolveConflict Application._p_resolveConflict = Application_resolveConflict
class ProcessingNodeTestCase(backportUnittest.TestCase, ZopeTestCase.TestCase): class ProcessingNodeTestCase(ZopeTestCase.TestCase):
"""Minimal ERP5 TestCase class to process activities """Minimal ERP5 TestCase class to process activities
When a processing node starts, the portal may not exist yet, or its name is When a processing node starts, the portal may not exist yet, or its name is
......
#!/usr/bin/env python2.6 #!/usr/bin/env python2.7
import os import os
import re import re
import signal import signal
......
#!/usr/bin/env python2.6 #!/usr/bin/env python2.7
import argparse, pprint, socket, sys, time, xmlrpclib import argparse, sys
from DummyTaskDistributionTool import DummyTaskDistributionTool from erp5.util import taskdistribution
from ERP5TypeTestSuite import ERP5TypeTestSuite
# XXX: This import is required, just to populate sys.modules['test_suite'].
# Even if it's not used in this file. Yuck.
import ERP5TypeTestSuite
def _parsingErrorHandler(data, _):
print >> sys.stderr, 'Error parsing data:', repr(data)
taskdistribution.patchRPCParser(_parsingErrorHandler)
def makeSuite(node_quantity=None, test_suite=None, revision=None, def makeSuite(node_quantity=None, test_suite=None, revision=None,
db_list=None, **kwargs): db_list=None, **kwargs):
......
#!/usr/bin/env python2.6 #!/usr/bin/env python2.7
import os import os
import sys import sys
import pdb import pdb
...@@ -12,8 +12,6 @@ import errno ...@@ -12,8 +12,6 @@ import errno
import random import random
from glob import glob from glob import glob
import backportUnittest
WIN = os.name == 'nt' WIN = os.name == 'nt'
__doc__ = """%(program)s: unit test runner for the ERP5 Project __doc__ = """%(program)s: unit test runner for the ERP5 Project
...@@ -317,8 +315,7 @@ class ERP5TypeTestLoader(unittest.TestLoader): ...@@ -317,8 +315,7 @@ class ERP5TypeTestLoader(unittest.TestLoader):
return filtered_name_list return filtered_name_list
return name_list return name_list
# BBB: Python < 2.7 unittest.loader.TestLoader = ERP5TypeTestLoader
getattr(unittest, 'loader', unittest).TestLoader = ERP5TypeTestLoader
class DebugTestResult: class DebugTestResult:
"""Wrap an unittest.TestResult, invoking pdb on errors / failures """Wrap an unittest.TestResult, invoking pdb on errors / failures
...@@ -466,7 +463,7 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None): ...@@ -466,7 +463,7 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
root_db_name, = cfg.dbtab.databases.keys() root_db_name, = cfg.dbtab.databases.keys()
DbFactory(root_db_name).addMountPoint('/') DbFactory(root_db_name).addMountPoint('/')
TestRunner = backportUnittest.TextTestRunner TestRunner = unittest.TextTestRunner
import Lifetime import Lifetime
from Zope2.custom_zodb import Storage, save_mysql, \ from Zope2.custom_zodb import Storage, save_mysql, \
......
...@@ -33,9 +33,9 @@ import unittest ...@@ -33,9 +33,9 @@ import unittest
import transaction import transaction
from persistent import Persistent from persistent import Persistent
from unittest import expectedFailure, skip
from Products.ERP5Type.dynamic.portal_type_class import synchronizeDynamicModules from Products.ERP5Type.dynamic.portal_type_class import synchronizeDynamicModules
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.backportUnittest import expectedFailure, skip
from Products.ERP5Type.Core.PropertySheet import PropertySheet as PropertySheetDocument from Products.ERP5Type.Core.PropertySheet import PropertySheet as PropertySheetDocument
from zope.interface import Interface, implementedBy from zope.interface import Interface, implementedBy
......
...@@ -32,6 +32,7 @@ import sys ...@@ -32,6 +32,7 @@ import sys
import transaction import transaction
from random import randint from random import randint
from unittest import expectedFailure
from Acquisition import aq_base from Acquisition import aq_base
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import DummyLocalizer from Products.ERP5Type.tests.utils import DummyLocalizer
...@@ -48,7 +49,6 @@ from AccessControl.ZopeGuards import guarded_getattr, guarded_hasattr ...@@ -48,7 +49,6 @@ from AccessControl.ZopeGuards import guarded_getattr, guarded_hasattr
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.ERP5Type.tests.utils import removeZODBPythonScript from Products.ERP5Type.tests.utils import removeZODBPythonScript
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Type.tests.backportUnittest import expectedFailure
class PropertySheetTestCase(ERP5TypeTestCase): class PropertySheetTestCase(ERP5TypeTestCase):
"""Base test case class for property sheets tests. """Base test case class for property sheets tests.
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zope.interface.verify import verifyClass from zope.interface.verify import verifyClass
from Products.ERP5Type.tests.backportUnittest import expectedFailure
import unittest import unittest
implements_tuple_list = [ implements_tuple_list = [
...@@ -96,7 +95,7 @@ for failing_method in [ ...@@ -96,7 +95,7 @@ for failing_method in [
'test_Products.ERP5Type.ConsistencyMessage_ConsistencyMessage_implements_IConsistencyMessage', 'test_Products.ERP5Type.ConsistencyMessage_ConsistencyMessage_implements_IConsistencyMessage',
]: ]:
setattr(TestERP5TypeInterfaces, failing_method, setattr(TestERP5TypeInterfaces, failing_method,
expectedFailure(getattr(TestERP5TypeInterfaces,failing_method))) unittest.expectedFailure(getattr(TestERP5TypeInterfaces,failing_method)))
def test_suite(): def test_suite():
......
...@@ -35,6 +35,7 @@ import random ...@@ -35,6 +35,7 @@ import random
import socket import socket
import sys import sys
import transaction import transaction
import unittest
import ZODB import ZODB
import zLOG import zLOG
from App.config import getConfiguration from App.config import getConfiguration
...@@ -43,7 +44,6 @@ from Zope2.Startup.datatypes import ZopeDatabase ...@@ -43,7 +44,6 @@ from Zope2.Startup.datatypes import ZopeDatabase
import Products.ERP5Type import Products.ERP5Type
from Products.MailHost.MailHost import MailHost from Products.MailHost.MailHost import MailHost
from email import message_from_string from email import message_from_string
import backportUnittest
from Products.ERP5Type.Globals import PersistentMapping from Products.ERP5Type.Globals import PersistentMapping
from Products.ERP5Type.Utils import simple_decorator from Products.ERP5Type.Utils import simple_decorator
from Products.ZSQLCatalog.SQLCatalog import Catalog from Products.ZSQLCatalog.SQLCatalog import Catalog
...@@ -387,9 +387,7 @@ def reindex(func): ...@@ -387,9 +387,7 @@ def reindex(func):
# The test will be skipped: # The test will be skipped:
# - the fixture itself is not run # - the fixture itself is not run
# - if a TODO test is in fact successful, no one will ever know # - if a TODO test is in fact successful, no one will ever know
# todo_erp5 = unittest.skip("TODO ERP5")
# Test cases using this decorator must extend backportUnittest.TestCase
todo_erp5 = backportUnittest.skip("TODO ERP5")
class LogInterceptor: class LogInterceptor:
'''Replacement for Products.CMFCore.tests.base.testcase.LogInterceptor '''Replacement for Products.CMFCore.tests.base.testcase.LogInterceptor
......
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