aboutsummaryrefslogtreecommitdiff
path: root/crosperf/schedv2_unittest.py
diff options
context:
space:
mode:
authorZhizhou Yang <zhizhouy@google.com>2020-01-15 16:25:04 -0800
committerCommit Bot <commit-bot@chromium.org>2020-01-30 00:33:44 +0000
commit5534af8f4f31df22ca307e3e3faa16487fa3d2d2 (patch)
tree771f9865e956551c7c70c3de99fad0b72aef52ce /crosperf/schedv2_unittest.py
parent658d77957b84def71c77d25229df9845fdb7ee9c (diff)
downloadtoolchain-utils-5534af8f4f31df22ca307e3e3faa16487fa3d2d2.tar.gz
crosperf: migration to python 3
This patch migrates crosperf and its utils to python 3. TEST=Passed presubmit check; tested with simple experiment locally. BUG=chromium:1011676 Change-Id: Ib2a9f9c7cf6a1bb1d0b42a1dd3d9e3cbb4d70a36 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2003796 Tested-by: Zhizhou Yang <zhizhouy@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Caroline Tice <cmtice@chromium.org> Commit-Queue: Zhizhou Yang <zhizhouy@google.com> Auto-Submit: Zhizhou Yang <zhizhouy@google.com>
Diffstat (limited to 'crosperf/schedv2_unittest.py')
-rwxr-xr-xcrosperf/schedv2_unittest.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/crosperf/schedv2_unittest.py b/crosperf/schedv2_unittest.py
index 3ccf6fa4..7b56d723 100755
--- a/crosperf/schedv2_unittest.py
+++ b/crosperf/schedv2_unittest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2015 The Chromium OS Authors. All rights reserved.
@@ -12,8 +12,7 @@ from __future__ import print_function
import functools
import io
import unittest
-
-import mock
+import unittest.mock as mock
import benchmark_run
import test_flag
@@ -81,7 +80,7 @@ class Schedv2Test(unittest.TestCase):
Note - we mock out BenchmarkRun in this step.
"""
- experiment_file = ExperimentFile(io.BytesIO(expstr))
+ experiment_file = ExperimentFile(io.StringIO(expstr))
experiment = ExperimentFactory().GetExperiment(
experiment_file, working_directory='', log_dir='')
return experiment
@@ -200,7 +199,7 @@ class Schedv2Test(unittest.TestCase):
# The non-cache-hit brs are put into Schedv2._label_brl_map.
self.assertEqual(
functools.reduce(lambda a, x: a + len(x[1]),
- my_schedv2.get_label_map().iteritems(), 0), 30)
+ my_schedv2.get_label_map().items(), 0), 30)
def test_nocachehit(self):
"""Test no cache-hit."""
@@ -218,7 +217,7 @@ class Schedv2Test(unittest.TestCase):
# The non-cache-hit brs are put into Schedv2._label_brl_map.
self.assertEqual(
functools.reduce(lambda a, x: a + len(x[1]),
- my_schedv2.get_label_map().iteritems(), 0), 60)
+ my_schedv2.get_label_map().items(), 0), 60)
if __name__ == '__main__':