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

Follow python 2.7.

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