Reland "[Autotest] Python3 files/server/* migration"
Fixed the division errors
This is a reland of b05fb5a3dd205d085395c3e2f7d05127cabd07ec
TEST=network_WiFi_ChannelHop && network_WiFi_SimpleConnect.wifi_check24HT20
Original change's description:
> [Autotest] Python3 files/server/* migration
>
> Does not include subdirs
> TEST=applicable unittests, compiling in py2 and py3
> BUG=chromium:990593
>
> Change-Id: I668c7531e7fc926f9a20c3bf2bab0d62eb3e3926
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2318565
> Commit-Queue: Derek Beckett <[email protected]>
> Tested-by: Derek Beckett <[email protected]>
> Reviewed-by: Greg Edelston <[email protected]>
Bug: chromium:990593
Change-Id: I912aa024130987af313dc472a273267669e6b69c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2373204
Commit-Queue: Derek Beckett <[email protected]>
Tested-by: Derek Beckett <[email protected]>
Reviewed-by: Greg Edelston <[email protected]>
Reviewed-by: Gregory Nisbet <[email protected]>
Auto-Submit: Derek Beckett <[email protected]>
diff --git a/server/sequence.py b/server/sequence.py
index a44f65f..f38bc2d 100644
--- a/server/sequence.py
+++ b/server/sequence.py
@@ -1,3 +1,4 @@
+# Lint as: python2, python3
# 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.
@@ -6,6 +7,10 @@
Adds ability to schedule jobs on given machines.
"""
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+
import logging
import os
@@ -16,6 +21,8 @@
from autotest_lib.server.cros.dynamic_suite import control_file_getter
from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
from autotest_lib.site_utils import job_directories
+import six
+from six.moves import range
MINUTE_IN_SECS = 60
HOUR_IN_MINUTES = 60
@@ -82,7 +89,7 @@
@returns a timeout value for the test, 4h by default.
"""
if self._duration:
- return 2 * int(self._duration) / MINUTE_IN_SECS
+ return 2 * int(self._duration) // MINUTE_IN_SECS
# default value:
return DEFAULT_JOB_TIMEOUT_IN_MINS
@@ -108,7 +115,7 @@
return cntl_file_getter.get_control_file_contents_by_name(
self._name)
child_args = ['',]
- for arg, value in self._args.iteritems():
+ for arg, value in six.iteritems(self._args):
child_args.append('%s=%s' % (arg, repr(value)))
if self._duration:
child_args.append('duration=%d' % self._duration)
@@ -143,7 +150,7 @@
runtime_mins = self.child_job_timeout()
hostname = utils.get_hostname_from_machine(machine)
- for i in xrange(0, self._iteration):
+ for i in range(0, self._iteration):
child_job_name = self.child_job_name(hostname, i)
logging.debug('Creating job: %s', child_job_name)
afe.create_job(