diff --git a/autocertkit/ack_cli.py b/autocertkit/ack_cli.py index 54a6c36..8a782ff 100755 --- a/autocertkit/ack_cli.py +++ b/autocertkit/ack_cli.py @@ -63,7 +63,8 @@ def get_xapi_session(config): def parse_cmd_args(): - parser = OptionParser(usage="%prog [options]", version="%prog @KIT_VERSION@") # NOSONAR + parser = OptionParser( # NOSONAR + usage="%prog [options]", version="%prog @KIT_VERSION@") # NOSONAR parser.add_option("-d", "--debug", dest="debug", diff --git a/autocertkit/models.py b/autocertkit/models.py index de9d704..8ee6520 100644 --- a/autocertkit/models.py +++ b/autocertkit/models.py @@ -377,7 +377,7 @@ def __init__(self, xml_device_node): # We only care about child element nodes child_elems = [node for node in xml_device_node.childNodes - if node.nodeType == node.ELEMENT_NODE] + if node.nodeType == node.ELEMENT_NODE] # We expect there to be one child node 'certification_tests' if len(child_elems) != 1: @@ -566,8 +566,10 @@ def print_report(self, stream): self.print_results(stream, tests_passed, "Tests that passed:") self.print_results(stream, tests_failed_req, "Tests that failed:") - self.print_results(stream, tests_failed_noreq, "None required tests that failed:") - self.print_results(stream, tests_skipped_req + tests_skipped_noreq, "Tests that skipped:") + self.print_results(stream, tests_failed_noreq, + "None required tests that failed:") + self.print_results(stream, tests_skipped_req + + tests_skipped_noreq, "Tests that skipped:") def print_results(self, stream, res, header): if res: diff --git a/autocertkit/network_tests.py b/autocertkit/network_tests.py index 0102086..aa0cb8b 100644 --- a/autocertkit/network_tests.py +++ b/autocertkit/network_tests.py @@ -654,7 +654,8 @@ def _run_test(self, session, direction): log.debug("About to run iperf test...") iperf_data = IperfTest(session, client, server, self.network_for_test, self.get_static_manager(self.network_for_test), - {'config': self.IPERF_ARGS, 'multicast_ip': self.MULTICAST_IP} + {'config': self.IPERF_ARGS, + 'multicast_ip': self.MULTICAST_IP} ).run() return {'info': 'Test ran successfully', @@ -968,7 +969,7 @@ class MulticastTestClass(IperfTestClass): IPERF_ARGS = {'format': 'm', 'thread_count': '4'} - MULTICAST_IP = '226.94.1.1' # NOSONAR + MULTICAST_IP = '226.94.1.1' # NOSONAR class GROOffloadTestClass(testbase.NetworkTestClass): diff --git a/autocertkit/operations_tests.py b/autocertkit/operations_tests.py index e32c8e2..bfdee1e 100644 --- a/autocertkit/operations_tests.py +++ b/autocertkit/operations_tests.py @@ -56,7 +56,8 @@ def test_vm_power_control(self, session): state a predefined number of times""" vm_ref_list = self._setup_vms(session) for i in range(3): - log.debug("Starting test (power control) run %d of %d" % (i + 1, 3)) + log.debug("Starting test (power control) run %d of %d" % + (i + 1, 3)) # Make certain the VMs are available for vm_ref in vm_ref_list: @@ -129,7 +130,8 @@ def test_vm_reboot(self, session): run_xapi_async_tasks(session, task_list) # Verify the VMs report a 'Running' power state - log.debug("Verrifying VM power control operations (reboot) for 'Running'") + log.debug( + "Verrifying VM power control operations (reboot) for 'Running'") for vm_ref in vm_ref_list: if session.xenapi.VM.get_power_state(vm_ref) != 'Running': raise Exception("ERROR: Unexpected power state") @@ -187,7 +189,8 @@ def test_vm_suspend(self, session): run_xapi_async_tasks(session, task_list) # Verify the VMs report a 'Running' power state - log.debug("Verrifying VM power control operations (suspend) for 'Running'") + log.debug( + "Verrifying VM power control operations (suspend) for 'Running'") for vm_ref in vm_ref_list: if session.xenapi.VM.get_power_state(vm_ref) != 'Running': raise Exception("ERROR: VM %s did not resume" % vm_ref) @@ -226,7 +229,8 @@ def test_vm_relocation(self, session): run_xapi_async_tasks(session, task_list) # Verify the VMs report a 'Running' power state - log.debug("Verrifying VM power control operations (relocation) for 'Running'") + log.debug( + "Verrifying VM power control operations (relocation) for 'Running'") for vm_ref in vm_ref_list: if session.xenapi.VM.get_power_state(vm_ref) != 'Running': raise Exception("ERROR: Unexpected power state") diff --git a/autocertkit/test_generators.py b/autocertkit/test_generators.py index a8890e5..8c22b34 100644 --- a/autocertkit/test_generators.py +++ b/autocertkit/test_generators.py @@ -166,13 +166,13 @@ def append_xml_config(self, doc, xml_node): test_methods = test_class(self.session, self.config).list_tests() for method in test_methods: - self.add_method_node(doc, skip_this, test_class_name, xcp_version, class_node, method) + self.add_method_node( + doc, skip_this, test_class_name, xcp_version, class_node, method) cts_node.appendChild(class_node) xml_node.appendChild(device_node) - def set_test_class_cap(self, test_class, xcp_version): if test_class.REQUIRED_FOR: if utils.eval_expr(test_class.REQUIRED_FOR, xcp_version): @@ -184,7 +184,6 @@ def set_test_class_cap(self, test_class, xcp_version): return True return False - def add_method_node(self, doc, skipthis, test_class_name, xcp_version, class_node, method): method_node = doc.createElement('test_method') method_node.setAttribute('name', str(method)) diff --git a/autocertkit/test_runner.py b/autocertkit/test_runner.py index 2fb123a..34b6696 100644 --- a/autocertkit/test_runner.py +++ b/autocertkit/test_runner.py @@ -290,7 +290,8 @@ def get_test_class(fqtn): if __name__ == "__main__": # Main function entry point - parser = OptionParser(usage="%prog [-c] [-t]", version="%prog 0.1") # NOSONAR + parser = OptionParser( # NOSONAR + usage="%prog [-c] [-t]", version="%prog 0.1") # NOSONAR parser.add_option("-t", "--test file", dest="testfile", diff --git a/autocertkit/testbase.py b/autocertkit/testbase.py index 1e7c096..11a1d9e 100644 --- a/autocertkit/testbase.py +++ b/autocertkit/testbase.py @@ -390,7 +390,7 @@ def get_vlans(self, iface): def get_netconf(self): """Return the network config dictionary, as provided by the user""" - return eval(self.config['netconf']) # NOSONAR + return eval(self.config['netconf']) # NOSONAR def singlenicmode(self): return 'singlenic' in self.config.keys() and self.config['singlenic'] == 'true' @@ -593,7 +593,7 @@ def _run_test(self, session): # retrieve the logs log.debug("%s test is complete, retrieving logs" % self.test) self._call_plugin(session, vm_ref_list, - 'retrieve_' + self.test + '_logs') + 'retrieve_' + self.test + '_logs') return {'info': 'Test ran successfully'} diff --git a/autocertkit/utils.py b/autocertkit/utils.py index 905ab4a..7d17cf5 100644 --- a/autocertkit/utils.py +++ b/autocertkit/utils.py @@ -1251,7 +1251,8 @@ def ping(vm_ip, dst_vm_ip, interface, packet_size=1400, def ping_with_retry(session, vm_ref, mip, dst_vm_ip, interface, timeout=20, retry=15): - loss_re = re.compile(""".* (?P[0-9]+)% packet loss, .*""", re.S) # NOSONAR + loss_re = re.compile( + """.* (?P[0-9]+)% packet loss, .*""", re.S) # NOSONAR cmd_str = "ping -I %s -w %d %s" % (interface, timeout, dst_vm_ip) cmd = binascii.hexlify(cmd_str) @@ -1851,7 +1852,8 @@ def init_ifs_ip_addressing(session, vm_ref, vifs_info): device = "ethx%d" % id mac, ip, netmask, gw = vif_info[1], vif_info[2], vif_info[3], vif_info[4] if ip: - dev_info = {'iface': device, 'mac': mac, 'ip': ip, 'netmask': netmask, 'gw': gw} + dev_info = {'iface': device, 'mac': mac, + 'ip': ip, 'netmask': netmask, 'gw': gw} droid_add_static_ifcfg(session, host_ref, vm_ref, mip, dev_info) else: droid_add_dhcp_ifcfg(session, host_ref, vm_ref, mip, device, mac) @@ -2641,7 +2643,8 @@ def get_ack_version(session, host=None): try: return call_ack_plugin(session, 'get_ack_version', {}, host=host) except XenAPI.Failure, e: - log.debug("Failed to execute ack plugin call means ACK is not installed. Exception: %s" % str(e)) + log.debug( + "Failed to execute ack plugin call means ACK is not installed. Exception: %s" % str(e)) return None