Commit c31011c3 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Arnaud Fontaine

WIP: py2/py3: make erp5_core_test code compatible.

parent d3a022e0
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
############################################################################## ##############################################################################
from functools import partial from functools import partial
import httplib import six.moves.http_client
from random import randint from random import randint
import sys import sys
import threading import threading
...@@ -4113,7 +4113,7 @@ VALUES ...@@ -4113,7 +4113,7 @@ VALUES
ret = self.publish( ret = self.publish(
self.portal.portal_catalog.getPath(), self.portal.portal_catalog.getPath(),
basic='ERP5TypeTestCase:') basic='ERP5TypeTestCase:')
self.assertEqual(httplib.OK, ret.getStatus()) self.assertEqual(six.moves.http_client.OK, ret.getStatus())
# check if we did not just publish the result of `str(portal_catalog.__call__())`, # check if we did not just publish the result of `str(portal_catalog.__call__())`,
# but a proper page # but a proper page
self.assertIn('<title>Catalog Tool - portal_catalog', ret.getBody()) self.assertIn('<title>Catalog Tool - portal_catalog', ret.getBody())
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
############################################################################## ##############################################################################
import pprint import pprint
import httplib import six.moves.http_client
import urlparse import six.moves.urllib.parse
import base64 import base64
import urllib import urllib
import lxml.html import lxml.html
...@@ -629,9 +629,9 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -629,9 +629,9 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
self.commit() self.commit()
self.tic() self.tic()
_, api_netloc, _, _, _ = urlparse.urlsplit(self.portal.absolute_url()) _, api_netloc, _, _, _ = six.moves.urllib.parse.urlsplit(self.portal.absolute_url())
connection = httplib.HTTPConnection(api_netloc) connection = six.moves.http_client.HTTPConnection(api_netloc)
connection.request( connection.request(
method='GET', method='GET',
url='%s/Person_getPrimaryGroup' % \ url='%s/Person_getPrimaryGroup' % \
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
try: try:
from ZODB._compat import cPickle from ZODB._compat import cPickle
except ImportError: # BBB: ZODB < 4 except ImportError: # BBB: ZODB < 4
import cPickle import six.moves.cPickle
import unittest import unittest
import sys import sys
import mock import mock
...@@ -330,7 +330,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): ...@@ -330,7 +330,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
portal.person_module._setObject(o.getId(), aq_base(o)) portal.person_module._setObject(o.getId(), aq_base(o))
try: try:
self.commit() self.commit()
except cPickle.PicklingError: except six.moves.cPickle.PicklingError:
self.abort() self.abort()
else: else:
self.fail("No exception raised when storing explicitly a temp object" self.fail("No exception raised when storing explicitly a temp object"
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
import contextlib import contextlib
import unittest import unittest
from threading import Thread from threading import Thread
from thread import get_ident from six.moves._thread import get_ident
from unittest import skip from unittest import skip
import transaction import transaction
......
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