Commit f732c52b authored by Jérome Perrin's avatar Jérome Perrin

erp5_core_test: pylint for py3

parent d2288a27
......@@ -113,7 +113,7 @@ class TestAlarm(AlarmTestCase):
finally:
self.portal.portal_activities.manageClearActivities(keep=0)
else:
raise Exception('Tic did not raise though activity was supposed to fail')
self.fail('Tic did not raise though activity was supposed to fail')
# Make the sense method succeed and leave a trace
self.getPortal().portal_skins[skin_folder_id][sense_method_id].ZPythonScript_edit('*args,**kw', 'context.newActiveProcess()')
alarm.activeSense()
......
......@@ -642,7 +642,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
self.assertEqual(['5'],folder_object_list)
if six.PY2:
folder_object_list = [x.getObject().getId() for x in
person_module.searchFolder(title=unicode(title, 'utf-8'))]
person_module.searchFolder(title=six.text_type(title, 'utf-8'))]
self.assertEqual(['5'],folder_object_list)
def test_Collation(self):
......@@ -2167,7 +2167,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
result = query('SELECT * FROM roles_and_users WHERE allowedRolesAndUsers LIKE "%s:%%" AND uid = %i' % (line['allowedRolesAndUsers'], uid) )
self.assertNotEqual(len(result), 0, 'No line found for allowedRolesAndUsers=%r and uid=%i' % (line['allowedRolesAndUsers'], uid))
else:
raise Exception('Malformed allowedRolesAndUsers value: %(allowedRolesAndUsers)r' % line)
raise ValueError('Malformed allowedRolesAndUsers value: %(allowedRolesAndUsers)r' % line)
# Check that object that 'bar' can view because of 'Author' role can *not*
# be found when searching for his other 'Whatever' role.
......@@ -4067,7 +4067,8 @@ VALUES
def doSomething(self, message_list):
r = []
for m in message_list:
m.result = r.append(m.object.getPath())
r.append(m.object.getPath())
m.result = None
r.sort()
group_method_call_list.append(r)
self.portal.portal_activities.__class__.doSomething = doSomething
......
......@@ -42,20 +42,19 @@ from Products.ERP5Type.tests.utils import DummyTranslationService
from zExceptions import Unauthorized
if 1: # BBB
# Zope 2.12, simulate setting the globalTranslationService with
# zope.i18n utilities
import zope.interface
import zope.component
import Acquisition
# Zope 2.12, simulate setting the globalTranslationService with
# zope.i18n utilities
import zope.interface
import zope.component
import Acquisition
global_translation_service = None
global_translation_service = None
from zope.i18n.interfaces import ITranslationDomain, \
from zope.i18n.interfaces import ITranslationDomain, \
IFallbackTranslationDomainFactory
@zope.interface.implementer(ITranslationDomain)
@zope.interface.provider(IFallbackTranslationDomainFactory)
class DummyTranslationDomainFallback(object):
@zope.interface.implementer(ITranslationDomain)
@zope.interface.provider(IFallbackTranslationDomainFactory)
class DummyTranslationDomainFallback(object):
def __init__(self, domain):
self.domain = domain
......@@ -64,7 +63,7 @@ if 1: # BBB
return global_translation_service.translate(self.domain, msgid, mapping,
*args, **kw)
def setGlobalTranslationService(translation_service):
def setGlobalTranslationService(translation_service):
global global_translation_service # pylint:disable=global-statement
global_translation_service = translation_service
zope.component.provideUtility(DummyTranslationDomainFallback,
......@@ -84,7 +83,7 @@ if 1: # BBB
portal._save_ui_domain = [ui_domain]
sm.unregisterUtility(provided=ITranslationDomain, name='ui')
def unregister_translation_domain_fallback():
def unregister_translation_domain_fallback():
from zope.component.globalregistry import base
base.unregisterUtility(DummyTranslationDomainFallback)
sm = zope.component.getSiteManager()
......@@ -96,6 +95,7 @@ if 1: # BBB
sm.registerUtility(ui_domain, ITranslationDomain, 'ui')
del portal._save_ui_domain
HTTP_OK = 200
HTTP_UNAUTHORIZED = 401
HTTP_REDIRECT = 302
......@@ -599,7 +599,8 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
# now let's simulate a site just migrated from Zope 2.8 that's being
# accessed for the first time:
from Products.ERP5 import ERP5Site
if 1: # BBB
# BBB
setSite()
# Sites from Zope2.8 don't have a site_manager yet.
del self.portal._components
......
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