diff --git a/avocado_vt/plugins/vt_resolver.py b/avocado_vt/plugins/vt_resolver.py index fd27d77cae..6e97946de8 100644 --- a/avocado_vt/plugins/vt_resolver.py +++ b/avocado_vt/plugins/vt_resolver.py @@ -27,7 +27,7 @@ def _parameters_to_runnable(self, params): # scalars, and will not be used in the context of nrunner for key in ('_name_map_file', '_short_name_map_file', 'dep'): if key in vt_params: - del(vt_params[key]) + del (vt_params[key]) return Runnable('avocado-vt', uri, **vt_params) diff --git a/avocado_vt/test.py b/avocado_vt/test.py index 6554201615..0f177de419 100644 --- a/avocado_vt/test.py +++ b/avocado_vt/test.py @@ -156,11 +156,11 @@ def setUp(self): finally: # Clean libvirtd debug logs if the test is not fail or error if self.params.get("libvirtd_log_cleanup", "no") == "yes": - if(self.params.get("vm_type") == 'libvirt' and - self.params.get("enable_libvirtd_debug_log", "yes") == "yes"): + if (self.params.get("vm_type") == 'libvirt' and + self.params.get("enable_libvirtd_debug_log", "yes") == "yes"): libvirtd_log = self.params["libvirtd_debug_file"] - if("TestFail" not in str(self.__exc_info) and - "TestError" not in str(self.__exc_info)): + if ("TestFail" not in str(self.__exc_info) and + "TestError" not in str(self.__exc_info)): if libvirtd_log and os.path.isfile(libvirtd_log): self.log.info("cleaning libvirtd logs...") os.remove(libvirtd_log) diff --git a/virttest/guest_agent.py b/virttest/guest_agent.py index b8a96bec68..084a203394 100644 --- a/virttest/guest_agent.py +++ b/virttest/guest_agent.py @@ -73,8 +73,8 @@ def __init__(self, cmd): self.ecmd = cmd def __str__(self): - return("The command %s is not supported by the current version qga" - % self.ecmd) + return ("The command %s is not supported by the current version qga" + % self.ecmd) class VAgentSyncError(VAgentError): diff --git a/virttest/libvirt_xml/vm_xml.py b/virttest/libvirt_xml/vm_xml.py index 47661f3c9c..03996334b8 100755 --- a/virttest/libvirt_xml/vm_xml.py +++ b/virttest/libvirt_xml/vm_xml.py @@ -819,7 +819,7 @@ def set_vm_vcpus(vm_name, vcpus, current=None, sockets=None, cores=None, if vcpus is not None: if current is not None: try: - if(int(current) > vcpus): + if (int(current) > vcpus): raise xcepts.LibvirtXMLError("The cpu current value %s " "is larger than max " "number %s" % (current, diff --git a/virttest/nfs.py b/virttest/nfs.py index dfcf6b6446..efbb8c2582 100644 --- a/virttest/nfs.py +++ b/virttest/nfs.py @@ -192,8 +192,8 @@ def __init__(self, params): path.find_command("service") path.find_command("exportfs") - if(params.get("setup_remote_nfs") == "yes" or - params.get("setup_local_nfs") == "yes"): + if (params.get("setup_remote_nfs") == "yes" or + params.get("setup_local_nfs") == "yes"): if 'Ubuntu' in distro_details or 'rhel' in distro_details: self.nfs_service = service.Service("nfs-server", session=self.session) @@ -247,8 +247,8 @@ def setup(self): self.unexportfs_in_clean = not self.exportfs.already_exported LOG.debug("Mount %s to %s" % (self.mount_src, self.mount_dir)) - if(utils_misc.check_exists(self.mount_dir, session=self.session) - and not utils_misc.check_isdir(self.mount_dir, session=self.session)): + if (utils_misc.check_exists(self.mount_dir, session=self.session) + and not utils_misc.check_isdir(self.mount_dir, session=self.session)): raise OSError( "Mount point %s is not a directory, check your setup." % self.mount_dir) diff --git a/virttest/ppm_utils.py b/virttest/ppm_utils.py index 771bf13a93..3c0ba86ee0 100644 --- a/virttest/ppm_utils.py +++ b/virttest/ppm_utils.py @@ -215,12 +215,12 @@ def image_verify_ppm_file(filename): try: size = os.path.getsize(filename) with open(filename, "rb") as fin: - assert(fin.readline().strip() == b"P6") + assert (fin.readline().strip() == b"P6") (width, height) = map(int, fin.readline().split()) - assert(width > 0 and height > 0) - assert(fin.readline().strip() == b"255") + assert (width > 0 and height > 0) + assert (fin.readline().strip() == b"255") size_read = fin.tell() - assert(size - size_read == width * height * 3) + assert (size - size_read == width * height * 3) return True except Exception: return False diff --git a/virttest/qemu_devices/qdevices.py b/virttest/qemu_devices/qdevices.py index 57214674ad..97dad26f51 100644 --- a/virttest/qemu_devices/qdevices.py +++ b/virttest/qemu_devices/qdevices.py @@ -138,7 +138,7 @@ def set_param(self, option, value, option_type=None, dynamic=False): else: self.params[option] = value elif value is None and option in self.params: - del(self.params[option]) + del (self.params[option]) if option in self.dynamic_params: self.dynamic_params.remove(option) @@ -152,7 +152,7 @@ def __getitem__(self, option): def __delitem__(self, option): """ deletes self.params[option] """ - del(self.params[option]) + del (self.params[option]) def __len__(self): """ length of self.params """ @@ -2371,7 +2371,7 @@ def remove(self, device): remove = key break if remove is not None: - del(self.bus[remove]) + del (self.bus[remove]) return True return False diff --git a/virttest/qemu_vm.py b/virttest/qemu_vm.py index d7632dbf32..b3d74d764a 100644 --- a/virttest/qemu_vm.py +++ b/virttest/qemu_vm.py @@ -3785,9 +3785,9 @@ def hotplug_vcpu(self, cpu_id=None, plug_command="", unplug=""): else: modified_vcpu_threads = vcpu_threads_count + add_remove_count if len(self.vcpu_threads) == modified_vcpu_threads: - return(True, plug_cpu_id) + return (True, plug_cpu_id) else: - return(False, cmd_output) + return (False, cmd_output) @error_context.context_aware def hotplug_vcpu_device(self, vcpu_id): diff --git a/virttest/shared/scripts/virtio_console_guest.py b/virttest/shared/scripts/virtio_console_guest.py index 62788240c9..1f0afa4659 100755 --- a/virttest/shared/scripts/virtio_console_guest.py +++ b/virttest/shared/scripts/virtio_console_guest.py @@ -998,7 +998,7 @@ def init(self, in_files): remove.append(port['name']) print("Fail to open port %s" % port['name']) for name in remove: - del(self.ports[name]) + del (self.ports[name]) # Check if in_files count and system port count matches # TODO: Not all devices are listed diff --git a/virttest/storage.py b/virttest/storage.py index d1af2710f8..86e60ff1fb 100644 --- a/virttest/storage.py +++ b/virttest/storage.py @@ -721,14 +721,14 @@ def copy_nfs_image(params, root_dir, basename=False): # check for image availability in NFS shared path base_dir = params["nfs_mount_dir"] dst = get_image_filename(params, base_dir, basename=basename) - if(not os.path.isfile(dst) or - utils_misc.get_image_info(dst)['lcounts'].lower() == "true"): + if (not os.path.isfile(dst) or + utils_misc.get_image_info(dst)['lcounts'].lower() == "true"): source = get_image_filename(params, root_dir) LOG.debug("Checking for image available in image data " "path - %s", source) # check for image availability in images data directory - if(os.path.isfile(source) and not - utils_misc.get_image_info(source)['lcounts'].lower() == "true"): + if (os.path.isfile(source) and not + utils_misc.get_image_info(source)['lcounts'].lower() == "true"): LOG.debug("Copying guest image from %s to %s", source, dst) shutil.copy(source, dst) else: diff --git a/virttest/tests/unattended_install.py b/virttest/tests/unattended_install.py index 420813fa37..381bdab6cd 100644 --- a/virttest/tests/unattended_install.py +++ b/virttest/tests/unattended_install.py @@ -896,10 +896,10 @@ def setup_cdrom(self): i.copy(os.path.join(self.boot_path, os.path.basename(self.kernel)), self.kernel) - assert(os.path.getsize(self.kernel) > 0) + assert (os.path.getsize(self.kernel) > 0) i.copy(os.path.join(self.boot_path, os.path.basename(self.initrd)), self.initrd) - assert(os.path.getsize(self.initrd) > 0) + assert (os.path.getsize(self.initrd) > 0) if self.unattended_file.endswith('.preseed'): self.preseed_initrd() diff --git a/virttest/utils_spice.py b/virttest/utils_spice.py index 7415174585..37f952ff53 100644 --- a/virttest/utils_spice.py +++ b/virttest/utils_spice.py @@ -215,13 +215,13 @@ def get_vdagent_status(vm_session, test_timeout): except ShellCmdError: # getting the status of vdagent stopped returns 3, which results in a # ShellCmdError - return("stopped") + return ("stopped") except Exception: print("Unexpected error:", sys.exc_info()[0]) raise exceptions.TestFail( "Failed attempting to get status of spice-vdagentd") wait_timeout(3) - return(output) + return (output) def verify_virtio(guest_session, test_timeout): diff --git a/virttest/utils_test/libvirt.py b/virttest/utils_test/libvirt.py index f922ba986b..497ea9fcf0 100644 --- a/virttest/utils_test/libvirt.py +++ b/virttest/utils_test/libvirt.py @@ -3864,7 +3864,7 @@ def check_qemu_cmd_line(content, err_ignore=False, :return: True if exist, False otherwise """ cmd = 'pgrep -a qemu' - if not(remote_params or runner_on_target): + if not (remote_params or runner_on_target): qemu_line = process.run(cmd, shell=True).stdout_text else: cmd_result = remote_old.run_remote_cmd(cmd, remote_params, runner_on_target) diff --git a/virttest/virt_vm.py b/virttest/virt_vm.py index e588dc3f2a..143cdc2415 100644 --- a/virttest/virt_vm.py +++ b/virttest/virt_vm.py @@ -1013,8 +1013,8 @@ def verify_dmesg(self, dmesg_log_file=None, connect_uri=None): serial_login = self.params.get("serial_login", "no") == "yes" if serial_login: self.session = self.wait_for_serial_login() - elif(len(self.virtnet) > 0 and self.virtnet[0].nettype != "macvtap" and - not connect_uri): + elif (len(self.virtnet) > 0 and self.virtnet[0].nettype != "macvtap" and + not connect_uri): self.session = self.wait_for_login() expected_guest_dmesg = self.params.get("expected_guest_dmesg", "") return utils_misc.verify_dmesg(dmesg_log_file=dmesg_log_file,