Commit 0c539b1a authored by Jérome Perrin's avatar Jérome Perrin

test: don't use sys.maxint for python3 compatibility

use sys.maxsize, see discussion on
!1751 (comment 203735)
parent 7a429a7c
...@@ -571,7 +571,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): ...@@ -571,7 +571,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
# otherwise it returns the object # otherwise it returns the object
self.assertEqual(obj, portal_catalog.getObject(obj.getUid()).getObject()) self.assertEqual(obj, portal_catalog.getObject(obj.getUid()).getObject())
# but raises KeyError if object is not in catalog # but raises KeyError if object is not in catalog
self.assertRaises(KeyError, portal_catalog.getObject, sys.maxint) self.assertRaises(KeyError, portal_catalog.getObject, sys.maxsize)
self.assertRaises(KeyError, portal_catalog.getObject, -1)
def test_getRecordForUid(self): def test_getRecordForUid(self):
portal_catalog = self.getCatalogTool() portal_catalog = self.getCatalogTool()
...@@ -583,7 +584,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): ...@@ -583,7 +584,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
portal_catalog = self.getCatalogTool() portal_catalog = self.getCatalogTool()
obj = self._makeOrganisation() obj = self._makeOrganisation()
self.assertEqual(obj.getPath(), portal_catalog.getpath(obj.getUid())) self.assertEqual(obj.getPath(), portal_catalog.getpath(obj.getUid()))
self.assertRaises(KeyError, portal_catalog.getpath, sys.maxint) self.assertRaises(KeyError, portal_catalog.getpath, sys.maxsize)
self.assertRaises(KeyError, portal_catalog.getpath, -1)
def test_16_newUid(self): def test_16_newUid(self):
# newUid should not assign the same uid # newUid should not assign the same uid
......
...@@ -148,7 +148,7 @@ class SavedTestSuite(ERP5TypeTestSuite): ...@@ -148,7 +148,7 @@ class SavedTestSuite(ERP5TypeTestSuite):
def __init__(self, *args, **kw): def __init__(self, *args, **kw):
# Use same portal id for all tests run by current instance # Use same portal id for all tests run by current instance
# but keep it (per-run) random. # but keep it (per-run) random.
self._portal_id = 'portal_%i' % (random.randint(0, sys.maxint), ) self._portal_id = 'portal_%i' % (random.randint(0, sys.maxsize), )
self._setup_failed = False self._setup_failed = False
super(SavedTestSuite, self).__init__(*args, **kw) super(SavedTestSuite, self).__init__(*args, **kw)
......
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