summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWAMOTO Toshihiro <iwamoto@valinux.co.jp>2015-06-30 17:01:58 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-07-01 10:13:23 +0900
commitffb409135ee512b26b896bb8e5749f28f95e2ba7 (patch)
tree516b084e7b2e779ad1d78837c0086de2b9993e57
parent8fe50be72f39004efd8333f81ebfcc807668b209 (diff)
python3: Misc. python3 fix
These are several kinds of python3 compatibility idioms. Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/tests/switch/tester.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ryu/tests/switch/tester.py b/ryu/tests/switch/tester.py
index 815ea279..6c4e2336 100644
--- a/ryu/tests/switch/tester.py
+++ b/ryu/tests/switch/tester.py
@@ -1322,7 +1322,7 @@ class TestFile(stringify.StringifyMixin):
self._normalize_test_json(v)
def _get_tests(self, path):
- with open(path, 'rb') as fhandle:
+ with open(path, 'r') as fhandle:
buf = fhandle.read()
try:
json_list = json.loads(buf)
@@ -1334,7 +1334,7 @@ class TestFile(stringify.StringifyMixin):
self.tests.append(Test(test_json))
except (ValueError, TypeError) as e:
result = (TEST_FILE_ERROR %
- {'file': path, 'detail': e.message})
+ {'file': path, 'detail': str(e)})
self.logger.warning(result)
@@ -1349,7 +1349,7 @@ class Test(stringify.StringifyMixin):
def __test_pkt_from_json(test):
data = eval('/'.join(test))
data.serialize()
- return str(data.data)
+ return six.binary_type(data.data)
def __normalize_match(ofproto, match):
match_json = match.to_jsondict()