Fix incompatible code with python3 for tox pep8 test

"tox -e pep8" fails when python3 is used.
This patch fixes it.

Closes-Bug: #1583984

Change-Id: Idff17f64d2d4789acee08bd98902ae50312ddc92
This commit is contained in:
Hideki Saito
2016-05-20 20:44:37 +09:00
parent 331968496a
commit d47747260f
2 changed files with 4 additions and 4 deletions

View File

@@ -309,7 +309,7 @@ def _merge_args(qCmd, parsed_args, _extra_values, value_specs):
if isinstance(arg_value, list): if isinstance(arg_value, list):
if value and isinstance(value, list): if value and isinstance(value, list):
if (not arg_value or if (not arg_value or
type(arg_value[0]) == type(value[0])): isinstance(arg_value[0], type(value[0]))):
arg_value.extend(value) arg_value.extend(value)
_extra_values.pop(key) _extra_values.pop(key)

View File

@@ -20,7 +20,7 @@ import contextlib
import cStringIO import cStringIO
import fixtures import fixtures
import mox import mox
from six import iteritems import six
import sys import sys
import testtools import testtools
@@ -112,7 +112,7 @@ class MyComparator(mox.Comparator):
def _com_dict(self, lhs, rhs): def _com_dict(self, lhs, rhs):
if len(lhs) != len(rhs): if len(lhs) != len(rhs):
return False return False
for key, value in iteritems(lhs): for key, value in lhs.items():
if key not in rhs: if key not in rhs:
return False return False
rhs_value = rhs[key] rhs_value = rhs[key]
@@ -304,7 +304,7 @@ class CLITestV10Base(testtools.TestCase):
args.append("--tag") args.append("--tag")
for tag in tags: for tag in tags:
args.append(tag) args.append(tag)
if isinstance(tag, unicode): if isinstance(tag, six.string_types):
tag = urllib.quote(tag.encode('utf-8')) tag = urllib.quote(tag.encode('utf-8'))
if query: if query:
query += "&tag=" + tag query += "&tag=" + tag