[verify ]Fix several py3 issues

1. switch \u2714 to :-)
   a. \u2714 can not be decoded on py3
   b. \u2714 can not shown rightly on Window as Linux

2. compatiable py3 and py2 for load_lists

Change-Id: I8ac7f5560b0c0d51bf744e1be6bf3768c978e5df
This commit is contained in:
chenhb 2019-04-19 11:56:43 +08:00 committed by Andrey Kurilin
parent c5a5bc83de
commit 45cc9ad01f
5 changed files with 19 additions and 8 deletions

View File

@ -1081,7 +1081,8 @@ class _Verification(APIGroup):
"There are no failed tests from verification (UUID=%s)."
% verification_uuid)
else:
tests = tests.keys()
# py2 and py3
tests = list(tests.keys())
deployment = (deployment_id if deployment_id
else verification.deployment_uuid)

View File

@ -43,6 +43,8 @@ LIST_VERIFICATIONS_HINT = ("HINT: You can list all verifications, executing "
DEFAULT_REPORT_TYPES = ("HTML", "HTML-Static", "JSON", "JUnit-XML")
ACTIVE = u":-)"
class VerifyCommands(object):
"""Verify an OpenStack cloud via a verifier."""
@ -175,7 +177,7 @@ class VerifyCommands(object):
formatters = {
"Created at": lambda v: v["created_at"],
"Updated at": lambda v: v["updated_at"],
"Active": lambda v: u"\u2714" if v["uuid"] == cv else "",
"Active": lambda v: ACTIVE if v["uuid"] == cv else "",
}
cliutils.print_list(verifiers, fields, formatters=formatters,
normalize_field_names=True, sortby_index=4)
@ -202,8 +204,8 @@ class VerifyCommands(object):
formatters = {
"Created at": lambda v: v["created_at"].replace("T", " "),
"Updated at": lambda v: v["updated_at"].replace("T", " "),
"Active": lambda v: u"\u2714"
if v["uuid"] == used_verifier else None,
"Active": lambda v: (ACTIVE
if v["uuid"] == used_verifier else None),
"Extra settings": lambda v: (json.dumps(v["extra_settings"],
indent=4)
if v["extra_settings"] else None),

View File

@ -360,7 +360,15 @@ class VerifierManager(plugin.Plugin):
"'%s' verifiers don't support extensions." % self.get_name())
def list_extensions(self):
"""List all verifier extensions."""
"""List all verifier extensions.
Every extension is a dict object which contains
name and entry_point keys. example:
{
"name": p.name,
"entry_point": p.entry_point_target
}
"""
return []
def uninstall_extension(self, name):

View File

@ -202,8 +202,8 @@ class Rally(object):
return output
except subprocess.CalledProcessError as e:
output = e.output
raise RallyCliError(cmd, e.returncode, e.output)
output = encodeutils.safe_decode(e.output)
raise RallyCliError(cmd, e.returncode, output)
finally:
if write_report:
if not report_path:

View File

@ -1955,7 +1955,7 @@ class VerificationAPITestCase(test.TestCase):
concurrency=1)
mock_start.assert_called_once_with(
verifier_id="v_uuid", deployment_id="d_uuid",
load_list=tests.keys(), tags=None, concurrency=1)
load_list=list(tests.keys()), tags=None, concurrency=1)
@mock.patch("rally.api._Verification.start")
@mock.patch("rally.api.objects.Verification.create")