From 80c1e9a96ad3e992fb6504463ce1eaacd1e5a7e9 Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Fri, 26 Nov 2021 11:45:04 +0100 Subject: [PATCH] Fix more pylint warnings JIRA: TRNSPRTPCE-320 Signed-off-by: guillaume.lambert Change-Id: Ia99c607c48ad4a6bb305bf800e8f54d1f741e4df --- .../1.2.1/test01_portmapping.py | 1 + .../test04_renderer_service_path_nominal.py | 1 + tests/transportpce_tests/1.2.1/test05_olm.py | 1 + .../1.2.1/test06_end2end.py | 3 ++ .../2.2.1/test01_portmapping.py | 1 + .../2.2.1/test02_topo_portmapping.py | 1 + .../2.2.1/test04_otn_topology.py | 1 + .../2.2.1/test05_flex_grid.py | 1 + tests/transportpce_tests/2.2.1/test09_olm.py | 1 + tests/transportpce_tests/2.2.1/test10_tapi.py | 1 + .../2.2.1/test12_end2end.py | 3 ++ .../2.2.1/test13_tapi_full_multi_layer.py | 39 ++++++++++--------- .../2.2.1/test14_otn_switch_end2end.py | 1 + .../7.1/test01_portmapping.py | 1 + tests/transportpce_tests/common/test_utils.py | 8 ++-- .../common/test_utils_rfc8040.py | 10 ++--- .../test01_device_change_notifications.py | 1 + .../hybrid/test02_B100G_end2end.py | 1 + tests/transportpce_tests/pce/test01_pce.py | 8 ++-- .../transportpce_tests/pce/test02_pce_400G.py | 12 +++--- .../with_docker/test01_gnpy.py | 8 ++-- .../with_docker/test02_nbinotifications.py | 1 + 22 files changed, 65 insertions(+), 40 deletions(-) diff --git a/tests/transportpce_tests/1.2.1/test01_portmapping.py b/tests/transportpce_tests/1.2.1/test01_portmapping.py index e94852fdb..9d28b0c4d 100644 --- a/tests/transportpce_tests/1.2.1/test01_portmapping.py +++ b/tests/transportpce_tests/1.2.1/test01_portmapping.py @@ -41,6 +41,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): print("all processes killed") def setUp(self): + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) time.sleep(10) diff --git a/tests/transportpce_tests/1.2.1/test04_renderer_service_path_nominal.py b/tests/transportpce_tests/1.2.1/test04_renderer_service_path_nominal.py index c6390cffb..485ce4169 100644 --- a/tests/transportpce_tests/1.2.1/test04_renderer_service_path_nominal.py +++ b/tests/transportpce_tests/1.2.1/test04_renderer_service_path_nominal.py @@ -41,6 +41,7 @@ class TransportPCERendererTesting(unittest.TestCase): print("all processes killed") def setUp(self): + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) time.sleep(10) diff --git a/tests/transportpce_tests/1.2.1/test05_olm.py b/tests/transportpce_tests/1.2.1/test05_olm.py index 19473bd8b..050609975 100644 --- a/tests/transportpce_tests/1.2.1/test05_olm.py +++ b/tests/transportpce_tests/1.2.1/test05_olm.py @@ -44,6 +44,7 @@ class TransportOlmTesting(unittest.TestCase): print("all processes killed") def setUp(self): + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) time.sleep(1) diff --git a/tests/transportpce_tests/1.2.1/test06_end2end.py b/tests/transportpce_tests/1.2.1/test06_end2end.py index f33eeccc6..c8f4eac61 100644 --- a/tests/transportpce_tests/1.2.1/test06_end2end.py +++ b/tests/transportpce_tests/1.2.1/test06_end2end.py @@ -141,6 +141,7 @@ class TransportPCEFulltesting(unittest.TestCase): print("all processes killed") def setUp(self): # instruction executed before each test method + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) # connect netconf devices @@ -816,6 +817,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.test_35_check_topo_ROADMA_DEG1() def test_49_loop_create_eth_service(self): + # pylint: disable=consider-using-f-string for i in range(1, 6): print("iteration number {}".format(i)) print("eth service creation") @@ -833,6 +835,7 @@ class TransportPCEFulltesting(unittest.TestCase): response = test_utils.service_delete_request("service1") time.sleep(5) + # pylint: disable=consider-using-f-string for i in range(1, 6): print("iteration number {}".format(i)) print("oc service creation") diff --git a/tests/transportpce_tests/2.2.1/test01_portmapping.py b/tests/transportpce_tests/2.2.1/test01_portmapping.py index f5f38e0b4..fa650b742 100644 --- a/tests/transportpce_tests/2.2.1/test01_portmapping.py +++ b/tests/transportpce_tests/2.2.1/test01_portmapping.py @@ -41,6 +41,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): print("all processes killed") def setUp(self): + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) time.sleep(10) diff --git a/tests/transportpce_tests/2.2.1/test02_topo_portmapping.py b/tests/transportpce_tests/2.2.1/test02_topo_portmapping.py index 6051f7e53..06e83473b 100644 --- a/tests/transportpce_tests/2.2.1/test02_topo_portmapping.py +++ b/tests/transportpce_tests/2.2.1/test02_topo_portmapping.py @@ -57,6 +57,7 @@ class TransportPCEtesting(unittest.TestCase): nbMappings = 0 for i in range(0, len(firstEntry)): nodeId = firstEntry[i]['node-id'] + # pylint: disable=consider-using-f-string print("nodeId={}".format(nodeId)) nodeMapId = nodeId.split("-")[0] + "-" + nodeId.split("-")[1] print("nodeMapId={}".format(nodeMapId)) diff --git a/tests/transportpce_tests/2.2.1/test04_otn_topology.py b/tests/transportpce_tests/2.2.1/test04_otn_topology.py index 5e9b3b858..41b1f65b0 100644 --- a/tests/transportpce_tests/2.2.1/test04_otn_topology.py +++ b/tests/transportpce_tests/2.2.1/test04_otn_topology.py @@ -185,6 +185,7 @@ class TransportPCEtesting(unittest.TestCase): tpId = res['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]['tp-id'] if tpType == 'XPONDER-CLIENT': client += 1 + # pylint: disable=consider-using-f-string print("tpId = {}".format(tpId)) print("tp= {}".format(res['network'][0]['node'][i] ['ietf-network-topology:termination-point'][j])) diff --git a/tests/transportpce_tests/2.2.1/test05_flex_grid.py b/tests/transportpce_tests/2.2.1/test05_flex_grid.py index 7c3dbff45..1fc4a3724 100644 --- a/tests/transportpce_tests/2.2.1/test05_flex_grid.py +++ b/tests/transportpce_tests/2.2.1/test05_flex_grid.py @@ -37,6 +37,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): print("all processes killed") def setUp(self): + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) time.sleep(10) diff --git a/tests/transportpce_tests/2.2.1/test09_olm.py b/tests/transportpce_tests/2.2.1/test09_olm.py index 37c41670a..63ced0f74 100644 --- a/tests/transportpce_tests/2.2.1/test09_olm.py +++ b/tests/transportpce_tests/2.2.1/test09_olm.py @@ -44,6 +44,7 @@ class TransportOlmTesting(unittest.TestCase): print("all processes killed") def setUp(self): + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) time.sleep(1) diff --git a/tests/transportpce_tests/2.2.1/test10_tapi.py b/tests/transportpce_tests/2.2.1/test10_tapi.py index cbc6e857a..2faec1bd1 100644 --- a/tests/transportpce_tests/2.2.1/test10_tapi.py +++ b/tests/transportpce_tests/2.2.1/test10_tapi.py @@ -176,6 +176,7 @@ class TransportTapitesting(unittest.TestCase): def setUp(self): # instruction executed before each test method if self.init_failed: self.fail('Feature installation failed') + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) def test_01_get_tapi_topology_T100G(self): diff --git a/tests/transportpce_tests/2.2.1/test12_end2end.py b/tests/transportpce_tests/2.2.1/test12_end2end.py index 333244a7f..9472e3892 100644 --- a/tests/transportpce_tests/2.2.1/test12_end2end.py +++ b/tests/transportpce_tests/2.2.1/test12_end2end.py @@ -134,6 +134,7 @@ class TransportPCEFulltesting(unittest.TestCase): print("all processes killed") def setUp(self): # instruction executed before each test method + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) def test_01_connect_xpdrA(self): @@ -766,6 +767,7 @@ class TransportPCEFulltesting(unittest.TestCase): def test_49_loop_create_eth_service(self): for i in range(1, 6): + # pylint: disable=consider-using-f-string print("iteration number {}".format(i)) print("eth service creation") self.test_11_create_eth_service1() @@ -783,6 +785,7 @@ class TransportPCEFulltesting(unittest.TestCase): time.sleep(5) for i in range(1, 6): + # pylint: disable=consider-using-f-string print("iteration number {}".format(i)) print("oc service creation") self.test_36_create_oc_service1() diff --git a/tests/transportpce_tests/2.2.1/test13_tapi_full_multi_layer.py b/tests/transportpce_tests/2.2.1/test13_tapi_full_multi_layer.py index 37318b08a..8987dedb2 100644 --- a/tests/transportpce_tests/2.2.1/test13_tapi_full_multi_layer.py +++ b/tests/transportpce_tests/2.2.1/test13_tapi_full_multi_layer.py @@ -255,8 +255,9 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(self.WAITING) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - global service_pm_uuid - service_pm_uuid = res['output']['service']['uuid'] + global SERVICE_PM_UUID + SERVICE_PM_UUID = res['output']['service']['uuid'] + # pylint: disable=consider-using-f-string print("photonic media service uuid : {}".format(res['output']['service']['uuid'])) input_dict_1 = {'administrative-state': 'LOCKED', @@ -281,13 +282,13 @@ class TransportPCEtesting(unittest.TestCase): def test_16_get_service_PhotonicMedia(self): response = test_utils.get_service_list_request( - "services/" + str(service_pm_uuid)) + "services/" + str(SERVICE_PM_UUID)) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertEqual( res['services'][0]['administrative-state'], 'inService') self.assertEqual( - res['services'][0]['service-name'], service_pm_uuid) + res['services'][0]['service-name'], SERVICE_PM_UUID) self.assertEqual( res['services'][0]['connection-type'], 'infrastructure') self.assertEqual( @@ -307,8 +308,9 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(self.WAITING) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - global service_odu_uuid - service_odu_uuid = res['output']['service']['uuid'] + global SERVICE_ODU_UUID + SERVICE_ODU_UUID = res['output']['service']['uuid'] + # pylint: disable=consider-using-f-string print("odu service uuid : {}".format(res['output']['service']['uuid'])) input_dict_1 = {'administrative-state': 'LOCKED', @@ -333,13 +335,13 @@ class TransportPCEtesting(unittest.TestCase): def test_18_get_service_ODU(self): response = test_utils.get_service_list_request( - "services/" + str(service_odu_uuid)) + "services/" + str(SERVICE_ODU_UUID)) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertEqual( res['services'][0]['administrative-state'], 'inService') self.assertEqual( - res['services'][0]['service-name'], service_odu_uuid) + res['services'][0]['service-name'], SERVICE_ODU_UUID) self.assertEqual( res['services'][0]['connection-type'], 'infrastructure') self.assertEqual( @@ -360,8 +362,9 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(self.WAITING) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - global service_dsr_uuid - service_dsr_uuid = res['output']['service']['uuid'] + global SERVICE_DSR_UUID + SERVICE_DSR_UUID = res['output']['service']['uuid'] + # pylint: disable=consider-using-f-string print("dsr service uuid : {}".format(res['output']['service']['uuid'])) input_dict_1 = {'administrative-state': 'LOCKED', @@ -389,13 +392,13 @@ class TransportPCEtesting(unittest.TestCase): def test_20_get_service_DSR(self): response = test_utils.get_service_list_request( - "services/" + str(service_dsr_uuid)) + "services/" + str(SERVICE_DSR_UUID)) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertEqual( res['services'][0]['administrative-state'], 'inService') self.assertEqual( - res['services'][0]['service-name'], service_dsr_uuid) + res['services'][0]['service-name'], SERVICE_DSR_UUID) self.assertEqual( res['services'][0]['connection-type'], 'service') self.assertEqual( @@ -408,17 +411,17 @@ class TransportPCEtesting(unittest.TestCase): res = response.json() liste_service = res['output']['service'] for ele in liste_service: - if ele['uuid'] == service_pm_uuid: + if ele['uuid'] == SERVICE_PM_UUID: self.assertEqual(ele['operational-state'], 'ENABLED') self.assertEqual(ele['service-layer'], 'PHOTONIC_MEDIA') nbconnection = len(ele['connection']) self.assertEqual(nbconnection, 9, 'There should be 9 connections') - elif ele['uuid'] == service_odu_uuid: + elif ele['uuid'] == SERVICE_ODU_UUID: self.assertEqual(ele['operational-state'], 'ENABLED') self.assertEqual(ele['service-layer'], 'ODU') nbconnection = len(ele['connection']) self.assertEqual(nbconnection, 3, 'There should be 3 connections') - elif ele['uuid'] == service_dsr_uuid: + elif ele['uuid'] == SERVICE_DSR_UUID: self.assertEqual(ele['operational-state'], 'ENABLED') self.assertEqual(ele['service-layer'], 'DSR') nbconnection = len(ele['connection']) @@ -428,17 +431,17 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(2) def test_22_delete_connectivity_service_DSR(self): - response = test_utils.tapi_delete_connectivity_request(service_dsr_uuid) + response = test_utils.tapi_delete_connectivity_request(SERVICE_DSR_UUID) self.assertEqual(response.status_code, requests.codes.no_content) time.sleep(self.WAITING) def test_23_delete_connectivity_service_ODU(self): - response = test_utils.tapi_delete_connectivity_request(service_odu_uuid) + response = test_utils.tapi_delete_connectivity_request(SERVICE_ODU_UUID) self.assertEqual(response.status_code, requests.codes.no_content) time.sleep(self.WAITING) def test_24_delete_connectivity_service_PhotonicMedia(self): - response = test_utils.tapi_delete_connectivity_request(service_pm_uuid) + response = test_utils.tapi_delete_connectivity_request(SERVICE_PM_UUID) self.assertEqual(response.status_code, requests.codes.no_content) time.sleep(self.WAITING) diff --git a/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py b/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py index 4f87063eb..ab5a56225 100644 --- a/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py +++ b/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py @@ -737,6 +737,7 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) res = response.json() liste_tp = res['node'][0]['ietf-network-topology:termination-point'] + # pylint: disable=consider-using-f-string for ele in liste_tp: if ele['tp-id'] == 'XPDR2-NETWORK1': self.assertEqual({'frequency': 196.1, diff --git a/tests/transportpce_tests/7.1/test01_portmapping.py b/tests/transportpce_tests/7.1/test01_portmapping.py index 38971fd26..b5317f550 100644 --- a/tests/transportpce_tests/7.1/test01_portmapping.py +++ b/tests/transportpce_tests/7.1/test01_portmapping.py @@ -40,6 +40,7 @@ class TransportPCE400GPortMappingTesting(unittest.TestCase): print("all processes killed") def setUp(self): + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) time.sleep(10) diff --git a/tests/transportpce_tests/common/test_utils.py b/tests/transportpce_tests/common/test_utils.py index 95388ac6f..c18a4d1f5 100644 --- a/tests/transportpce_tests/common/test_utils.py +++ b/tests/transportpce_tests/common/test_utils.py @@ -133,7 +133,7 @@ def start_karaf(): executable = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", KARAF_INSTALLDIR, "target", "assembly", "bin", "karaf") - with open('odl.log', 'w') as outfile: + with open('odl.log', 'w', encoding='utf-8') as outfile: return subprocess.Popen( ["sh", executable, "server"], stdout=outfile, stderr=outfile, stdin=None) @@ -144,7 +144,7 @@ def start_lighty(): os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", "lighty", "target", "tpce", "clean-start-controller.sh") - with open(TPCE_LOG, 'w') as outfile: + with open(TPCE_LOG, 'w', encoding='utf-8') as outfile: return subprocess.Popen( ["sh", executable], stdout=outfile, stderr=outfile, stdin=None) @@ -498,7 +498,7 @@ def start_honeynode(log_file: str, sim): sample_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "openroadm", sim[1]) if os.path.isfile(executable): - with open(log_file, 'w') as outfile: + with open(log_file, 'w', encoding='utf-8') as outfile: return subprocess.Popen( [executable, SIMS[sim]['port'], os.path.join(sample_directory, SIMS[sim]['configfile'])], stdout=outfile, stderr=outfile) @@ -514,7 +514,7 @@ def wait_until_log_contains(log_file, regexp, time_to_wait=60): with TimeOut(seconds=time_to_wait): while not os.path.exists(log_file): time.sleep(0.2) - filelogs = open(log_file, 'r') + filelogs = open(log_file, 'r', encoding='utf-8') filelogs.seek(0, 2) filefound = True print("Searching for pattern '" + regexp + "' in " + os.path.basename(log_file), end='... ', flush=True) diff --git a/tests/transportpce_tests/common/test_utils_rfc8040.py b/tests/transportpce_tests/common/test_utils_rfc8040.py index 61506ed83..e1323f217 100644 --- a/tests/transportpce_tests/common/test_utils_rfc8040.py +++ b/tests/transportpce_tests/common/test_utils_rfc8040.py @@ -143,7 +143,7 @@ def start_karaf(): executable = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", KARAF_INSTALLDIR, "target", "assembly", "bin", "karaf") - with open('odl.log', 'w') as outfile: + with open('odl.log', 'w', encoding='utf-8') as outfile: return subprocess.Popen( ["sh", executable, "server"], stdout=outfile, stderr=outfile, stdin=None) @@ -154,7 +154,7 @@ def start_lighty(): os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", "lighty", "target", "tpce", "clean-start-controller.sh") - with open(TPCE_LOG, 'w') as outfile: + with open(TPCE_LOG, 'w', encoding='utf-8') as outfile: return subprocess.Popen( ["sh", executable], stdout=outfile, stderr=outfile, stdin=None) @@ -184,7 +184,7 @@ def start_honeynode(log_file: str, sim): sample_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "openroadm", sim[1]) if os.path.isfile(executable): - with open(log_file, 'w') as outfile: + with open(log_file, 'w', encoding='utf-8') as outfile: return subprocess.Popen( [executable, SIMS[sim]['port'], os.path.join(sample_directory, SIMS[sim]['configfile'])], stdout=outfile, stderr=outfile) @@ -200,7 +200,7 @@ def wait_until_log_contains(log_file, regexp, time_to_wait=60): with TimeOut(seconds=time_to_wait): while not os.path.exists(log_file): time.sleep(0.2) - filelogs = open(log_file, 'r') + filelogs = open(log_file, 'r', encoding='utf-8') filelogs.seek(0, 2) filefound = True print("Searching for pattern '" + regexp + "' in " + os.path.basename(log_file), end='... ', flush=True) @@ -308,7 +308,7 @@ def get_portmapping_node_info(node: str): url = "{}/data/transportpce-portmapping:network/nodes={}/node-info" response = get_request(url.format('{}', node)) res = response.json() - key = u'transportpce-portmapping:node-info' + key = 'transportpce-portmapping:node-info' if key in res.keys(): node_info = res[key] else: diff --git a/tests/transportpce_tests/hybrid/test01_device_change_notifications.py b/tests/transportpce_tests/hybrid/test01_device_change_notifications.py index b34204ba5..9ab4ae2d5 100644 --- a/tests/transportpce_tests/hybrid/test01_device_change_notifications.py +++ b/tests/transportpce_tests/hybrid/test01_device_change_notifications.py @@ -136,6 +136,7 @@ class TransportPCEFulltesting(unittest.TestCase): time.sleep(10) def setUp(self): # instruction executed before each test method + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) def test_01_connect_xpdrA(self): diff --git a/tests/transportpce_tests/hybrid/test02_B100G_end2end.py b/tests/transportpce_tests/hybrid/test02_B100G_end2end.py index e1236c1fb..b6d2612ec 100644 --- a/tests/transportpce_tests/hybrid/test02_B100G_end2end.py +++ b/tests/transportpce_tests/hybrid/test02_B100G_end2end.py @@ -9,6 +9,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +# pylint: disable=invalid-name # pylint: disable=no-member # pylint: disable=too-many-public-methods # pylint: disable=too-many-lines diff --git a/tests/transportpce_tests/pce/test01_pce.py b/tests/transportpce_tests/pce/test01_pce.py index 7c6771b33..e20a04a1b 100644 --- a/tests/transportpce_tests/pce/test01_pce.py +++ b/tests/transportpce_tests/pce/test01_pce.py @@ -38,22 +38,22 @@ class TransportPCEtesting(unittest.TestCase): sample_files_parsed = False TOPO_BI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "honeynode-topo.xml") - with open(TOPO_BI_DIR_FILE, 'r') as topo_bi_dir: + with open(TOPO_BI_DIR_FILE, 'r', encoding='utf-8') as topo_bi_dir: cls.simple_topo_bi_dir_data = topo_bi_dir.read() TOPO_UNI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "NW-simple-topology.xml") - with open(TOPO_UNI_DIR_FILE, 'r') as topo_uni_dir: + with open(TOPO_UNI_DIR_FILE, 'r', encoding='utf-8') as topo_uni_dir: cls.simple_topo_uni_dir_data = topo_uni_dir.read() TOPO_UNI_DIR_COMPLEX_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "NW-for-test-5-4.xml") - with open(TOPO_UNI_DIR_COMPLEX_FILE, 'r') as topo_uni_dir_complex: + with open(TOPO_UNI_DIR_COMPLEX_FILE, 'r', encoding='utf-8') as topo_uni_dir_complex: cls.complex_topo_uni_dir_data = topo_uni_dir_complex.read() PORT_MAPPING_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "pce_portmapping_121.json") - with open(PORT_MAPPING_FILE, 'r') as port_mapping: + with open(PORT_MAPPING_FILE, 'r', encoding='utf-8') as port_mapping: cls.port_mapping_data = port_mapping.read() sample_files_parsed = True except PermissionError as err: diff --git a/tests/transportpce_tests/pce/test02_pce_400G.py b/tests/transportpce_tests/pce/test02_pce_400G.py index 576ffdadb..d4f05705a 100644 --- a/tests/transportpce_tests/pce/test02_pce_400G.py +++ b/tests/transportpce_tests/pce/test02_pce_400G.py @@ -8,6 +8,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +# pylint: disable=invalid-name # pylint: disable=no-member # pylint: disable=too-many-public-methods @@ -36,31 +37,31 @@ class TransportPCE400Gtesting(unittest.TestCase): TOPO_BI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "honeynode-topo400G.json") - with open(TOPO_BI_DIR_FILE, 'r') as topo_bi_dir: + with open(TOPO_BI_DIR_FILE, 'r', encoding='utf-8') as topo_bi_dir: cls.topo_bi_dir_data = topo_bi_dir.read() OTN_TOPO_BI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "honeynode-otntopo400G.json") - with open(OTN_TOPO_BI_DIR_FILE, 'r') as otn_topo_bi_dir: + with open(OTN_TOPO_BI_DIR_FILE, 'r', encoding='utf-8') as otn_topo_bi_dir: cls.otn_topo_bi_dir_data = otn_topo_bi_dir.read() OTUC4_OTN_TOPO_BI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "honeynode-otntopo400GwithOTUC4.json") - with open(OTUC4_OTN_TOPO_BI_DIR_FILE, 'r') as otuc4_otn_topo_bi_dir: + with open(OTUC4_OTN_TOPO_BI_DIR_FILE, 'r', encoding='utf-8') as otuc4_otn_topo_bi_dir: cls.otuc4_otn_topo_bi_dir_data = otuc4_otn_topo_bi_dir.read() ODUC4_OTN_TOPO_BI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "honeynode-otntopo400GwithODUC4.json") - with open(ODUC4_OTN_TOPO_BI_DIR_FILE, 'r') as oduc4_otn_topo_bi_dir: + with open(ODUC4_OTN_TOPO_BI_DIR_FILE, 'r', encoding='utf-8') as oduc4_otn_topo_bi_dir: cls.oduc4_otn_topo_bi_dir_data = oduc4_otn_topo_bi_dir.read() PORT_MAPPING_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "pce_portmapping_71.json") - with open(PORT_MAPPING_FILE, 'r') as port_mapping: + with open(PORT_MAPPING_FILE, 'r', encoding='utf-8') as port_mapping: cls.port_mapping_data = port_mapping.read() sample_files_parsed = True except PermissionError as err: @@ -85,6 +86,7 @@ class TransportPCE400Gtesting(unittest.TestCase): print("all processes killed") def setUp(self): # instruction executed before each test method + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) time.sleep(1) diff --git a/tests/transportpce_tests/with_docker/test01_gnpy.py b/tests/transportpce_tests/with_docker/test01_gnpy.py index 2ca0dd0d2..99e717f59 100644 --- a/tests/transportpce_tests/with_docker/test01_gnpy.py +++ b/tests/transportpce_tests/with_docker/test01_gnpy.py @@ -39,21 +39,21 @@ class TransportGNPYtesting(unittest.TestCase): sample_files_parsed = False TOPO_CLLINET_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "gnpy", "clliNetwork.json") - with open(TOPO_CLLINET_FILE, 'r') as topo_cllinet: + with open(TOPO_CLLINET_FILE, 'r', encoding='utf-8') as topo_cllinet: cls.topo_cllinet_data = topo_cllinet.read() TOPO_ORDNET_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "gnpy", "openroadmNetwork.json") - with open(TOPO_ORDNET_FILE, 'r') as topo_ordnet: + with open(TOPO_ORDNET_FILE, 'r', encoding='utf-8') as topo_ordnet: cls.topo_ordnet_data = topo_ordnet.read() TOPO_ORDTOPO_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "gnpy", "openroadmTopology.json") - with open(TOPO_ORDTOPO_FILE, 'r') as topo_ordtopo: + with open(TOPO_ORDTOPO_FILE, 'r', encoding='utf-8') as topo_ordtopo: cls.topo_ordtopo_data = topo_ordtopo.read() PORT_MAPPING_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "gnpy", "gnpy_portmapping_121.json") - with open(PORT_MAPPING_FILE, 'r') as port_mapping: + with open(PORT_MAPPING_FILE, 'r', encoding='utf-8') as port_mapping: cls.port_mapping_data = port_mapping.read() sample_files_parsed = True except PermissionError as err: diff --git a/tests/transportpce_tests/with_docker/test02_nbinotifications.py b/tests/transportpce_tests/with_docker/test02_nbinotifications.py index 2d7edd617..a5be915c2 100644 --- a/tests/transportpce_tests/with_docker/test02_nbinotifications.py +++ b/tests/transportpce_tests/with_docker/test02_nbinotifications.py @@ -152,6 +152,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): print("all processes killed") def setUp(self): # instruction executed before each test method + # pylint: disable=consider-using-f-string print("execution of {}".format(self.id().split(".")[-1])) def test_01_connect_xpdrA(self): -- 2.36.6