diff --git a/requirements.txt b/requirements.txt index 3b07c4a7..7d227259 100644 --- a/requirements.txt +++ b/requirements.txt @@ -37,3 +37,7 @@ requests>=2.2.0,!=2.4.0 SQLAlchemy>=0.9.7,<=0.9.99 sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 six>=1.9.0 + +# Python 2.6 related packages(see rally.common.costilius for more details) +ordereddict +simplejson>=2.2.0 diff --git a/setup.cfg b/setup.cfg index 1aaa7da2..e39b0f6a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,8 @@ classifier = Programming Language :: Python :: 2 Programming Language :: Python :: 2.6 Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.4 [files] packages = diff --git a/tests/functional/test_cli_task.py b/tests/functional/test_cli_task.py index fa6261bd..2bd1feb3 100644 --- a/tests/functional/test_cli_task.py +++ b/tests/functional/test_cli_task.py @@ -535,11 +535,11 @@ class SLATestCase(unittest.TestCase): rally("task sla_check") expected = [ {"benchmark": "KeystoneBasic.create_and_list_users", - "criterion": "max_seconds_per_iteration", + "criterion": "failure_rate", "detail": mock.ANY, "pos": 0, "status": "PASS"}, {"benchmark": "KeystoneBasic.create_and_list_users", - "criterion": "failure_rate", + "criterion": "max_seconds_per_iteration", "detail": mock.ANY, "pos": 0, "status": "PASS"} ] diff --git a/tests/functional/utils.py b/tests/functional/utils.py index 0229ab54..8f233206 100644 --- a/tests/functional/utils.py +++ b/tests/functional/utils.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_utils import encodeutils from six.moves import configparser import inspect @@ -37,7 +38,7 @@ class RallyCmdError(Exception): def __init__(self, code, output): self.code = code - self.output = output + self.output = encodeutils.safe_decode(output) def __str__(self): return "Code: %d Output: %s\n" % (self.code, self.output) @@ -50,7 +51,7 @@ class TaskConfig(object): def __init__(self, config): config_file = tempfile.NamedTemporaryFile(delete=False) - config_file.write(json.dumps(config).encode("utf-8")) + config_file.write(encodeutils.safe_encode(json.dumps(config))) config_file.close() self.filename = config_file.name @@ -159,7 +160,7 @@ class Rally(object): :param getjson: in cases, when rally prints JSON, you can catch output deserialized :param report_path: if present, rally command and its output will be - wretten to file with passed file name + written to file with passed file name :param raw: don't write command itself to report file. Only output will be written """ @@ -167,8 +168,8 @@ class Rally(object): if not isinstance(cmd, list): cmd = cmd.split(" ") try: - output = subprocess.check_output(self.args + cmd, - stderr=subprocess.STDOUT) + output = encodeutils.safe_decode(subprocess.check_output( + self.args + cmd, stderr=subprocess.STDOUT)) if write_report: if not report_path: @@ -181,6 +182,6 @@ class Rally(object): if getjson: return json.loads(output) - return output.decode("utf-8") + return output except subprocess.CalledProcessError as e: raise RallyCmdError(e.returncode, e.output)