Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 client/tests/kvm/tests/9p.py                    |  2 +-
 client/tests/kvm/tests/balloon_check.py         |  4 +---
 client/tests/kvm/tests/block_stream.py          |  4 ++--
 client/tests/kvm/tests/cpu_hotplug.py           |  6 +++---
 client/tests/kvm/tests/cpuflags.py              |  4 ++--
 client/tests/kvm/tests/enospc.py                |  2 +-
 client/tests/kvm/tests/floppy.py                |  2 +-
 client/tests/kvm/tests/ksm_overcommit.py        |  4 ++--
 client/tests/kvm/tests/nic_bonding.py           |  2 +-
 client/tests/kvm/tests/nic_hotplug.py           |  1 -
 client/tests/kvm/tests/pci_hotplug.py           |  2 +-
 client/tests/kvm/tests/perf_kvm.py              |  4 ----
 client/tests/kvm/tests/performance.py           | 16 ++++++++--------
 client/tests/kvm/tests/qmp_basic.py             |  8 ++++----
 client/tests/kvm/tests/set_link.py              |  4 ++--
 client/tests/kvm/tests/stepmaker.py             | 22 +++++++++-------------
 client/tests/kvm/tests/steps.py                 |  2 +-
 client/tests/kvm/tests/system_reset_bootable.py |  4 ++--
 client/tests/kvm/tests/time_manage.py           |  2 +-
 client/tests/kvm/tests/usb.py                   |  2 +-
 20 files changed, 43 insertions(+), 54 deletions(-)

diff --git a/client/tests/kvm/tests/9p.py b/client/tests/kvm/tests/9p.py
index 8f47973..7693b89 100644
--- a/client/tests/kvm/tests/9p.py
+++ b/client/tests/kvm/tests/9p.py
@@ -21,7 +21,7 @@ def run_9p(test, params, env):
     if mount_dir is None:
         logging.info("User Variable for mount dir is not set")
     else:
-        mkdir = session.get_command_output("mkdir -p %s" % mount_dir)
+        session.cmd("mkdir -p %s" % mount_dir)
 
         mount_option = " trans=virtio"
 
diff --git a/client/tests/kvm/tests/balloon_check.py 
b/client/tests/kvm/tests/balloon_check.py
index ddf7247..139d37f 100644
--- a/client/tests/kvm/tests/balloon_check.py
+++ b/client/tests/kvm/tests/balloon_check.py
@@ -39,8 +39,7 @@ def run_balloon_check(test, params, env):
         @param new_mem: New desired memory.
         @return: Number of failures occurred during operation.
         """
-        fail = 0
-        cur_mem, fail = check_ballooned_memory()
+        _, fail = check_ballooned_memory()
         if params.get("monitor_type") == "qmp":
             new_mem = new_mem * 1024 * 1024
         logging.info("Changing VM memory to %s", new_mem)
@@ -75,7 +74,6 @@ def run_balloon_check(test, params, env):
     vm.verify_alive()
     timeout = int(params.get("login_timeout", 360))
     session = vm.wait_for_login(timeout=timeout)
-    balloon_chk_cmd = params.get("balloon_chk_cmd")
 
     # Upper limit that we can raise the memory
     vm_assigned_mem = int(params.get("mem"))
diff --git a/client/tests/kvm/tests/block_stream.py 
b/client/tests/kvm/tests/block_stream.py
index 2b1fc23..675d341 100644
--- a/client/tests/kvm/tests/block_stream.py
+++ b/client/tests/kvm/tests/block_stream.py
@@ -1,6 +1,6 @@
-import re, os, logging, commands, string, time
+import re, os, logging, time
 from autotest.client.shared import utils, error
-from autotest.client.virt import kvm_monitor, utils_misc, virt_vm, aexpect
+from autotest.client.virt import kvm_monitor
 from autotest.client.virt import env_process
 
 @error.context_aware
diff --git a/client/tests/kvm/tests/cpu_hotplug.py 
b/client/tests/kvm/tests/cpu_hotplug.py
index aa48b71..d1ad66f 100644
--- a/client/tests/kvm/tests/cpu_hotplug.py
+++ b/client/tests/kvm/tests/cpu_hotplug.py
@@ -29,8 +29,8 @@ def run_cpu_hotplug(test, params, env):
     onoff_iterations = int(params.get("onoff_iterations", 20))
     total_cpus = current_cpus + n_cpus_add
 
-    error.context("getting guest dmesg before addition")
-    dmesg_before = session.cmd("dmesg -c")
+    error.context("cleaning guest dmesg before addition")
+    session.cmd("dmesg -c")
 
     error.context("Adding %d CPUs to guest" % n_cpus_add)
     for i in range(total_cpus):
@@ -45,7 +45,7 @@ def run_cpu_hotplug(test, params, env):
         raise error.TestFail("Monitor reports %s CPUs, when VM should have %s" 
%
                              (total_cpus_monitor, total_cpus))
 
-    dmesg_after = session.cmd("dmesg -c")
+    dmesg_after = session.cmd("dmesg")
     logging.debug("Guest dmesg output after CPU add:\n%s" % dmesg_after)
 
     # Verify whether the new cpus are showing up on /sys
diff --git a/client/tests/kvm/tests/cpuflags.py 
b/client/tests/kvm/tests/cpuflags.py
index 434ba0a..a59fbd9 100644
--- a/client/tests/kvm/tests/cpuflags.py
+++ b/client/tests/kvm/tests/cpuflags.py
@@ -1,7 +1,7 @@
 import logging, re, random, os, time, pickle, sys, traceback
 from autotest.client.shared import error, utils
 from autotest.client.virt import kvm_vm
-from autotest.client.virt import utils_misc, aexpect
+from autotest.client.virt import utils_misc, utils_test, aexpect
 
 
 def run_cpuflags(test, params, env):
@@ -702,7 +702,7 @@ def run_cpuflags(test, params, env):
 
             install_path = "/tmp"
 
-            class testMultihostMigration(utils_misc.MultihostMigration):
+            class testMultihostMigration(utils_test.MultihostMigration):
                 def __init__(self, test, params, env):
                     super(testMultihostMigration, self).__init__(test,
                                                                  params,
diff --git a/client/tests/kvm/tests/enospc.py b/client/tests/kvm/tests/enospc.py
index 23097a6..76d61dc 100644
--- a/client/tests/kvm/tests/enospc.py
+++ b/client/tests/kvm/tests/enospc.py
@@ -61,7 +61,7 @@ class EnospcConfig(object):
             # Let's symlink the logical volume with the image name that 
autotest
             # expects this device to have
             os.symlink(self.lvtest_device, self.qcow_file_path)
-        except Exception, e:
+        except Exception:
             self.cleanup()
             raise
 
diff --git a/client/tests/kvm/tests/floppy.py b/client/tests/kvm/tests/floppy.py
index 24cf961..730be70 100644
--- a/client/tests/kvm/tests/floppy.py
+++ b/client/tests/kvm/tests/floppy.py
@@ -36,7 +36,7 @@ def run_floppy(test, params, env):
     # Some Linux distribution does not load floppy at boot and Windows
     # needs time to load and init floppy driver
     if dest_dir:
-        status = session.cmd("modprobe floppy")
+        session.cmd("modprobe floppy")
     else:
         time.sleep(20)
 
diff --git a/client/tests/kvm/tests/ksm_overcommit.py 
b/client/tests/kvm/tests/ksm_overcommit.py
index d221046..4ee80ed 100644
--- a/client/tests/kvm/tests/ksm_overcommit.py
+++ b/client/tests/kvm/tests/ksm_overcommit.py
@@ -350,8 +350,8 @@ def run_ksm_overcommit(test, params, env):
         logging.info("Phase 2g: Simultaneous verification last 96B")
         for i in range(0, max_alloc):
             a_cmd = "mem.static_random_verify(96)"
-            (match, data) = _execute_allocator(a_cmd, vm, lsessions[i],
-                                               (mem / 200 * 50 * perf_ratio))
+            _, data = _execute_allocator(a_cmd, vm, lsessions[i],
+                                         (mem / 200 * 50 * perf_ratio))
         logging.debug(utils_test.get_memory_info([vm]))
         logging.info("Phase 2g: PASS")
 
diff --git a/client/tests/kvm/tests/nic_bonding.py 
b/client/tests/kvm/tests/nic_bonding.py
index 916b253..995ec8c 100644
--- a/client/tests/kvm/tests/nic_bonding.py
+++ b/client/tests/kvm/tests/nic_bonding.py
@@ -38,7 +38,7 @@ def run_nic_bonding(test, params, env):
     #do a pgrep to check if dhclient has already been running
     pgrep_cmd = "pgrep dhclient"
     try:
-        cmd_output = session_serial.cmd(pgrep_cmd)
+        session_serial.cmd(pgrep_cmd)
     #if dhclient is there, killl it
     except aexpect.ShellCmdError:
         logging.info("it's safe to run dhclient now")
diff --git a/client/tests/kvm/tests/nic_hotplug.py 
b/client/tests/kvm/tests/nic_hotplug.py
index 2b50cfa..9634211 100644
--- a/client/tests/kvm/tests/nic_hotplug.py
+++ b/client/tests/kvm/tests/nic_hotplug.py
@@ -29,7 +29,6 @@ def run_nic_hotplug(test, params, env):
     """
     vm = utils_test.get_living_vm(env, params.get("main_vm"))
     login_timeout = int(params.get("login_timeout", 360))
-    guest_delay = int(params.get("guest_delay", 20))
     pci_model = params.get("pci_model", "rtl8139")
     run_dhclient = params.get("run_dhclient", "no")
     guest_is_not_windows = "Win" not in params.get("guest_name", "")
diff --git a/client/tests/kvm/tests/pci_hotplug.py 
b/client/tests/kvm/tests/pci_hotplug.py
index cf68a83..b336d3f 100644
--- a/client/tests/kvm/tests/pci_hotplug.py
+++ b/client/tests/kvm/tests/pci_hotplug.py
@@ -137,7 +137,7 @@ def run_pci_hotplug(test, params, env):
     # Define a helper function to delete the device
     def pci_del(ignore_failure=False):
         if cmd_type == "pci_add":
-            result_domain, bus, slot, function = add_output.split(',')
+            result_domain, bus, slot, _ = add_output.split(',')
             domain = int(result_domain.split()[2])
             bus = int(bus.split()[1])
             slot = int(slot.split()[1])
diff --git a/client/tests/kvm/tests/perf_kvm.py 
b/client/tests/kvm/tests/perf_kvm.py
index f3ae148..cca4e3a 100644
--- a/client/tests/kvm/tests/perf_kvm.py
+++ b/client/tests/kvm/tests/perf_kvm.py
@@ -1,7 +1,4 @@
-import os, commands, glob
 from autotest.client import utils
-from autotest.client.shared import error
-from autotest.client.virt import utils_test
 
 
 def run_perf_kvm(test, params, env):
@@ -15,7 +12,6 @@ def run_perf_kvm(test, params, env):
     vm = env.get_vm(params["main_vm"])
     vm.verify_alive()
 
-    test_timeout = int(params.get("test_timeout", 240))
     login_timeout = int(params.get("login_timeout", 360))
     transfer_timeout = int(params.get("transfer_timeout", 240))
     perf_record_timeout = int(params.get("perf_record_timeout", 240))
diff --git a/client/tests/kvm/tests/performance.py 
b/client/tests/kvm/tests/performance.py
index 17c3971..7d0f2f0 100644
--- a/client/tests/kvm/tests/performance.py
+++ b/client/tests/kvm/tests/performance.py
@@ -155,14 +155,14 @@ def ffsb_sum(topdir, prefix, params, guest_ver, 
resultsdir):
         linestr.append(throughput)
         sum_thro += throughput
 
-        file = glob.glob(os.path.join(sub_dir, "guest_monitor_result*.sum"))[0]
-        str = open(file, "r").readlines()
-        linestr.append("%8.2f" % (100 - utils_test.aton(str[1].split()[3])))
-        linestr.append("%8.2f" % (100 - utils_test.aton(str[2].split()[3])))
-
-        file = glob.glob(os.path.join(sub_dir, "host_monitor_result*.sum"))[0]
-        str = open(file, "r").readlines()
-        hostcpu = 100 - utils_test.aton(str[-1].split()[3])
+        filename = glob.glob(os.path.join(sub_dir, 
"guest_monitor_result*.sum"))[0]
+        sr = open(filename, "r").readlines()
+        linestr.append("%8.2f" % (100 - utils_test.aton(sr[1].split()[3])))
+        linestr.append("%8.2f" % (100 - utils_test.aton(sr[2].split()[3])))
+
+        filename = glob.glob(os.path.join(sub_dir, 
"host_monitor_result*.sum"))[0]
+        sr = open(filename, "r").readlines()
+        hostcpu = 100 - utils_test.aton(sr[-1].split()[3])
         linestr.append(hostcpu)
         sum_hostcpu += hostcpu
         linestr.append("%.2f" % (throughput/hostcpu))
diff --git a/client/tests/kvm/tests/qmp_basic.py 
b/client/tests/kvm/tests/qmp_basic.py
index 05b39c0..2a2db03 100644
--- a/client/tests/kvm/tests/qmp_basic.py
+++ b/client/tests/kvm/tests/qmp_basic.py
@@ -77,7 +77,7 @@ def run_qmp_basic(test, params, env):
     def check_key_is_int(qmp_dict, key):
         fail_no_key(qmp_dict, key)
         try:
-            value = int(qmp_dict[key])
+            int(qmp_dict[key])
         except Exception:
             raise error.TestFail("'%s' key is not of type int, it's '%s'" %
                                  (key, type(qmp_dict[key])))
@@ -285,11 +285,11 @@ def run_qmp_basic(test, params, env):
         resp = monitor.cmd_obj({ "arguments": {}, "execute": "query-version" })
         check_success_resp(resp)
 
-        id = "1234foo"
-        resp = monitor.cmd_obj({ "id": id, "execute": "query-version",
+        idd = "1234foo"
+        resp = monitor.cmd_obj({ "id": idd, "execute": "query-version",
                                  "arguments": {} })
         check_success_resp(resp)
-        check_str_key(resp, "id", id)
+        check_str_key(resp, "id", idd)
 
         # TODO: would be good to test simple argument usage, but we don't have
         # a read-only command that accepts arguments.
diff --git a/client/tests/kvm/tests/set_link.py 
b/client/tests/kvm/tests/set_link.py
index 8e38a0e..ad242ca 100644
--- a/client/tests/kvm/tests/set_link.py
+++ b/client/tests/kvm/tests/set_link.py
@@ -29,13 +29,13 @@ def run_set_link(test, params, env):
         ip = vm.get_address(0)
 
         vm.set_link(linkid, up=False)
-        s, o = utils_test.ping(ip, count=10, timeout=20)
+        _, o = utils_test.ping(ip, count=10, timeout=20)
         if utils_test.get_loss_ratio(o) != 100:
             raise error.TestFail("Still can ping the %s after down %s" %
                                  (ip, linkid))
 
         vm.set_link(linkid, up=True)
-        s, o = utils_test.ping(ip, count=10, timeout=20)
+        _, o = utils_test.ping(ip, count=10, timeout=20)
         # we use 100% here as the notification of link status changed may be
         # delayed in guest driver
         if utils_test.get_loss_ratio(o) == 100:
diff --git a/client/tests/kvm/tests/stepmaker.py 
b/client/tests/kvm/tests/stepmaker.py
index ad65818..df1afdd 100755
--- a/client/tests/kvm/tests/stepmaker.py
+++ b/client/tests/kvm/tests/stepmaker.py
@@ -8,10 +8,6 @@ Step file creator/editor.
 """
 
 import pygtk, gtk, gobject, time, os, commands, logging
-try:
-    import autotest.common as common
-except ImportError:
-    import common
 from autotest.client.shared import error
 from autotest.client.virt import utils_misc, ppm_utils, step_editor
 from autotest.client.virt import kvm_monitor
@@ -184,26 +180,26 @@ class StepMaker(step_editor.StepMakerWindow):
             return
 
         # Get var values from user and write them to vars file
-        vars = {}
+        var_dict = {}
         for line in lines.splitlines():
             words = line.split()
             if words and words[0] == "var":
                 varname = words[1]
                 if varname in self.vars.keys():
                     val = self.vars[varname]
-                elif varname in vars.keys():
-                    val = vars[varname]
+                elif varname in var_dict.keys():
+                    val = var_dict[varname]
                 elif varname in self.params.keys():
                     val = self.params[varname]
-                    vars[varname] = val
+                    var_dict[varname] = val
                 else:
                     val = self.inputdialog("$%s =" % varname, "Variable")
                     if val == None:
                         return
-                    vars[varname] = val
-        for varname in vars.keys():
-            self.vars_file.write("%s=%s\n" % (varname, vars[varname]))
-        self.vars.update(vars)
+                    var_dict[varname] = val
+        for varname in var_dict.keys():
+            self.vars_file.write("%s=%s\n" % (varname, var_dict[varname]))
+        self.vars.update(var_dict)
 
         # Write step lines to file
         self.steps_file.write("# " + "-" * 32 + "\n")
@@ -277,7 +273,7 @@ class StepMaker(step_editor.StepMakerWindow):
     def update_capture(self):
         self.redirect_timer()
 
-        (screen, x, y, flags) = gtk.gdk.display_get_default().get_pointer()
+        (_, x, y, _) = gtk.gdk.display_get_default().get_pointer()
         self.mouse_click_coords[0] = int(x * self.spin_sensitivity.get_value())
         self.mouse_click_coords[1] = int(y * self.spin_sensitivity.get_value())
 
diff --git a/client/tests/kvm/tests/steps.py b/client/tests/kvm/tests/steps.py
index 00463d6..377c6d5 100644
--- a/client/tests/kvm/tests/steps.py
+++ b/client/tests/kvm/tests/steps.py
@@ -32,7 +32,7 @@ def barrier_2(vm, words, params, debug_dir, 
data_scrdump_filename,
         return False
 
     # Parse barrier command line
-    cmd, dx, dy, x1, y1, md5sum, timeout = words[:7]
+    _, dx, dy, x1, y1, md5sum, timeout = words[:7]
     dx, dy, x1, y1, timeout = map(int, [dx, dy, x1, y1, timeout])
 
     # Define some paths
diff --git a/client/tests/kvm/tests/system_reset_bootable.py 
b/client/tests/kvm/tests/system_reset_bootable.py
index 677a053..be5b2ff 100644
--- a/client/tests/kvm/tests/system_reset_bootable.py
+++ b/client/tests/kvm/tests/system_reset_bootable.py
@@ -22,10 +22,10 @@ def run_system_reset_bootable(test, params, env):
     logging.info("Wait for %d seconds before reset" % wait_time)
     time.sleep(wait_time)
 
-    for i in range(reset_times):
+    for _ in range(reset_times):
         logging.info("Reset the system by monitor cmd")
         vm.monitor.cmd("system_reset")
         time.sleep(interval)
 
     logging.info("Try to login guest after reset")
-    session = vm.wait_for_login(timeout=timeout)
+    vm.wait_for_login(timeout=timeout)
diff --git a/client/tests/kvm/tests/time_manage.py 
b/client/tests/kvm/tests/time_manage.py
index 8c3e32d..34dba01 100644
--- a/client/tests/kvm/tests/time_manage.py
+++ b/client/tests/kvm/tests/time_manage.py
@@ -1,4 +1,4 @@
-import logging, time, commands
+import logging, time
 from autotest.client.shared import error
 from autotest.client.virt import utils_test, aexpect
 from autotest.client.virt import env_process
diff --git a/client/tests/kvm/tests/usb.py b/client/tests/kvm/tests/usb.py
index c48b382..a4f441d 100644
--- a/client/tests/kvm/tests/usb.py
+++ b/client/tests/kvm/tests/usb.py
@@ -1,4 +1,4 @@
-import logging, os, re, uuid
+import logging, re, uuid
 from autotest.client.shared import error
 
 
-- 
1.7.11.4

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to