aboutsummaryrefslogtreecommitdiff
path: root/crosperf/schedv2_unittest.py
diff options
context:
space:
mode:
Diffstat (limited to 'crosperf/schedv2_unittest.py')
-rwxr-xr-xcrosperf/schedv2_unittest.py22
1 files changed, 8 insertions, 14 deletions
diff --git a/crosperf/schedv2_unittest.py b/crosperf/schedv2_unittest.py
index 4aced646..250968dc 100755
--- a/crosperf/schedv2_unittest.py
+++ b/crosperf/schedv2_unittest.py
@@ -1,19 +1,13 @@
#!/usr/bin/env python2
-# -*- coding: utf-8 -*-
-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
+# Copyright 2015 Google Inc. All Rights Reserved.
"""This contains the unit tests for the new Crosperf task scheduler."""
from __future__ import print_function
-import functools
-import io
-import unittest
-
import mock
+import unittest
+import StringIO
import benchmark_run
import test_flag
@@ -79,7 +73,7 @@ class Schedv2Test(unittest.TestCase):
Note - we mock out BenchmarkRun in this step.
"""
- experiment_file = ExperimentFile(io.BytesIO(expstr))
+ experiment_file = ExperimentFile(StringIO.StringIO(expstr))
experiment = ExperimentFactory().GetExperiment(
experiment_file, working_directory='', log_dir='')
return experiment
@@ -197,8 +191,8 @@ class Schedv2Test(unittest.TestCase):
self.assertEquals(len(my_schedv2.get_cached_run_list()), 30)
# The non-cache-hit brs are put into Schedv2._label_brl_map.
self.assertEquals(
- functools.reduce(lambda a, x: a + len(x[1]),
- my_schedv2.get_label_map().iteritems(), 0), 30)
+ reduce(lambda a, x: a + len(x[1]),
+ my_schedv2.get_label_map().iteritems(), 0), 30)
def test_nocachehit(self):
"""Test no cache-hit."""
@@ -215,8 +209,8 @@ class Schedv2Test(unittest.TestCase):
self.assertEquals(len(my_schedv2.get_cached_run_list()), 0)
# The non-cache-hit brs are put into Schedv2._label_brl_map.
self.assertEquals(
- functools.reduce(lambda a, x: a + len(x[1]),
- my_schedv2.get_label_map().iteritems(), 0), 60)
+ reduce(lambda a, x: a + len(x[1]),
+ my_schedv2.get_label_map().iteritems(), 0), 60)
if __name__ == '__main__':