fix some pylint issues 19/92419/6
authorguillaume.lambert <guillaume.lambert@orange.com>
Mon, 7 Sep 2020 14:44:51 +0000 (16:44 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Fri, 18 Sep 2020 14:33:12 +0000 (16:33 +0200)
and use a "#pylint disable=" comment to eliminate false positives

JIRA: TRNSPRTPCE-320
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I4a741f9f30f6d8e2e2ea209ad44f936cdaf6150f

21 files changed:
tests/transportpce_tests/1.2.1/test_end2end.py
tests/transportpce_tests/1.2.1/test_gnpy.py
tests/transportpce_tests/1.2.1/test_olm.py
tests/transportpce_tests/1.2.1/test_pce.py
tests/transportpce_tests/1.2.1/test_portmapping.py
tests/transportpce_tests/1.2.1/test_renderer_service_path_nominal.py
tests/transportpce_tests/1.2.1/test_topoPortMapping.py
tests/transportpce_tests/1.2.1/test_topology.py
tests/transportpce_tests/2.2.1/test_end2end.py
tests/transportpce_tests/2.2.1/test_olm.py
tests/transportpce_tests/2.2.1/test_otn_end2end.py
tests/transportpce_tests/2.2.1/test_otn_renderer.py
tests/transportpce_tests/2.2.1/test_otn_sh_renderer.py
tests/transportpce_tests/2.2.1/test_otn_topology.py
tests/transportpce_tests/2.2.1/test_portmapping.py
tests/transportpce_tests/2.2.1/test_renderer_service_path_nominal.py
tests/transportpce_tests/2.2.1/test_tapi.py
tests/transportpce_tests/2.2.1/test_topoPortMapping.py
tests/transportpce_tests/2.2.1/test_topology.py
tests/transportpce_tests/common/__init__.py [new file with mode: 0644]
tests/transportpce_tests/common/test_utils.py

index 5266a609554a9ec934c9b83a7b3c04a33ec06c9d..43c0348130c47a143b76a8c6882a4819758dfe2f 100644 (file)
@@ -127,6 +127,7 @@ class TransportPCEFulltesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index 0a77c0ff9c0d4c915d14288346f0af68a85a4a9e..80a92bf0dc1146f0c0ded39da425880431e7d828 100644 (file)
@@ -29,6 +29,7 @@ class TransportGNPYtesting(unittest.TestCase):
 
     @classmethod
     def setUpClass(cls):
+        # pylint: disable=bare-except
         try:
             sample_files_parsed = False
             TOPO_CLLINET_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
@@ -63,6 +64,7 @@ class TransportGNPYtesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index 0d4aca50768ff69d598a284677d95fda19e0161e..f7155e8bc1624e2507f2d3d64e7548fec2f569a7 100644 (file)
@@ -29,6 +29,7 @@ class TransportOlmTesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
@@ -428,7 +429,7 @@ class TransportOlmTesting(unittest.TestCase):
         self.assertIn('Request processed', res["output"]["result"])
         time.sleep(10)
 
-    """to test case where SRG where the xpdr is connected to has no optical range data"""
+    #"""to test case where SRG where the xpdr is connected to has no optical range data"""
 
     def test_31_connect_xprdA_to_roadmA(self):
         response = test_utils.connect_xpdr_to_rdm_request("XPDRA01", "1", "2",
index 55aab56d999030189a8007bf74451cf72dffd679..e7e255f9134ecd311beb997f59dae9ab4c646ef8 100644 (file)
@@ -28,6 +28,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     @classmethod
     def setUpClass(cls):
+        # pylint: disable=bare-except
         try:
             sample_files_parsed = False
             TOPO_BI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
@@ -63,6 +64,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index 6024ca2366cce4f0a2f632c2920e9472b22372f7..51694b5683ef88a8eddf2a4c221e381626fd37bd 100644 (file)
@@ -29,6 +29,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index 3f7ff41e0701c32bfe73aa6f88e67d4c19115e25..24b24230dcc9e937b912e1dadf26d0ce85cfd678 100644 (file)
@@ -29,6 +29,7 @@ class TransportPCERendererTesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index 48b501fa724db82092e5cec6b48a53b2ce25cf2e..683b04a48649fa5e491d09d3b21f8c05b8a20f41 100644 (file)
@@ -11,6 +11,8 @@
 
 # pylint: disable=no-member
 # pylint: disable=too-many-public-methods
+# a pylint false positive due to unittest
+# pylint: disable=no-self-use
 
 import time
 import unittest
@@ -29,6 +31,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
@@ -42,7 +45,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
 
     # Verify the termination points of the ROADMA
-    def test_02_compareOpenroadmTopologyPortMapping_rdm(self):
+    def test_02_compare_Openroadm_topology_portmapping_rdm(self):
         responseTopo = test_utils.get_ordm_topo_request("")
         resTopo = responseTopo.json()
         nbNode = len(resTopo['network'][0]['node'])
@@ -67,8 +70,8 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
 
 #     #Verify the termination points related to XPDR
-    def test_05_compareOpenroadmTopologyPortMapping_xpdr(self):
-        self.test_02_compareOpenroadmTopologyPortMapping_rdm()
+    def test_05_compare_Openroadm_topology_portmapping_xpdr(self):
+        self.test_02_compare_Openroadm_topology_portmapping_rdm()
 
     # Disconnect the XPDRA
     def test_06_disconnect_device(self):
index 827a30c4af7b08787b3fc92481d7d743d8f631fd..e088b6d7f7e80ec1f97c64f45bc0a2fbfa3a6ebe 100644 (file)
@@ -11,6 +11,7 @@
 
 # pylint: disable=no-member
 # pylint: disable=too-many-public-methods
+# pylint: disable=too-many-lines
 
 import time
 import unittest
@@ -29,6 +30,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
@@ -58,6 +60,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
         self.assertEqual(res['network'][0]['node'][0]['org-openroadm-network:model'], '2')
 
     def test_04_getLinks_OpenroadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
@@ -98,6 +101,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
         self.assertEqual(len(dropLink), 0)
 
     def test_05_getNodes_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         res = response.json()
         # Tests related to nodes
@@ -176,6 +180,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
         self.assertEqual(res['network'][0]['node'][0]['org-openroadm-clli-network:clli'], 'NodeA')
 
     def test_08_getOpenRoadmNetwork(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_net_request()
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
@@ -195,6 +200,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
                 self.assertFalse(True)
 
     def test_09_getNodes_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         res = response.json()
         # Tests related to nodes
@@ -292,6 +298,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
         self.assertEqual(response.status_code, requests.codes.ok)
 
     def test_12_getLinks_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
@@ -390,6 +397,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
         self.assertEqual(len(listNode), 0)
 
     def test_17_getOpenRoadmNetwork(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_net_request()
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
@@ -419,6 +427,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
         self.assertEqual(len(listNode), 0)
 
     def test_18_getROADMLinkOpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
@@ -499,13 +508,14 @@ class TransportPCETopologyTesting(unittest.TestCase):
                 length = (res['network'][0]['ietf-network-topology:link'][i]
                              ['org-openroadm-network-topology:OMS-attributes']['span']['link-concatenation'][0]
                              ['SRLG-length'])
-                if (spanLoss != None) & (length != None):
+                if (spanLoss is not None) & (length is not None):
                     find = True
                 self.assertTrue(find)
                 R2RLink.remove(link_id)
         self.assertEqual(len(R2RLink), 0)
 
     def test_20_getNodes_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         res = response.json()
         # Tests related to nodes
@@ -765,7 +775,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
                     'org-openroadm-network-topology:OMS-attributes']['span']["engineered-spanloss"]
                 length = res['network'][0]['ietf-network-topology:link'][i][
                     'org-openroadm-network-topology:OMS-attributes']['span']['link-concatenation'][0]['SRLG-length']
-                if (spanLoss != None) & (length != None):
+                if (spanLoss is not None) & (length is not None):
                     find = True
                 self.assertTrue(find)
                 R2RLink.remove(link_id)
@@ -787,6 +797,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
         self.assertEqual(response.status_code, requests.codes.ok)
 
     def test_32_getNodes_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         res = response.json()
         # Tests related to nodes
@@ -907,6 +918,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
             self.assertNotEqual(res['network'][0]['node'][i]['node-id'], 'XPDRA01')
 
     def test_38_getNodes_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         res = response.json()
         # Tests related to nodes
index b26f8937a73369706c35e7dcdf6af3da461260cf..bc9b3a634b64d191901ae85816601801674af2c3 100644 (file)
@@ -118,6 +118,7 @@ class TransportPCEFulltesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index f7b331ccc1b36a9402cb69202d2319f8c91dc4a2..4a5e97b48ed6368e88baa094889a5f192f36f7ae 100644 (file)
@@ -29,6 +29,7 @@ class TransportOlmTesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
@@ -429,7 +430,7 @@ class TransportOlmTesting(unittest.TestCase):
         self.assertIn('Request processed', res["output"]["result"])
         time.sleep(10)
 
-    """to test case where SRG where the xpdr is connected to has no optical range data"""
+   #"""to test case where SRG where the xpdr is connected to has no optical range data"""
 
     def test_31_connect_xprdA_to_roadmA(self):
         response = test_utils.connect_xpdr_to_rdm_request("XPDR-A1", "1", "2",
index ee0e0d1092ee0f042bcde90763fcf9c7e6eb7d93..d2208da6d8727f05201635885b552b3b65ce6f09 100644 (file)
@@ -132,6 +132,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
@@ -497,12 +498,12 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(nb_links, 4)
         for link in res['network'][0]['ietf-network-topology:link']:
             linkId = link['link-id']
-            if (linkId == 'OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1' or
-                    linkId == 'OTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1'):
+            if (linkId in ('OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1',
+                           'OTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1')):
                 self.assertEqual(link['org-openroadm-otn-network-topology:available-bandwidth'], 0)
                 self.assertEqual(link['org-openroadm-otn-network-topology:used-bandwidth'], 100000)
-            elif (linkId == 'ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1' or
-                  linkId == 'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1'):
+            elif (linkId in ('ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1',
+                             'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1')):
                 self.assertEqual(link['org-openroadm-otn-network-topology:available-bandwidth'], 100000)
                 self.assertEqual(link['org-openroadm-otn-network-topology:used-bandwidth'], 0)
                 self.assertEqual(link['transportpce-topology:otn-link-type'], 'ODTU4')
@@ -748,8 +749,8 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(nb_links, 4)
         for link in res['network'][0]['ietf-network-topology:link']:
             linkId = link['link-id']
-            if (linkId == 'ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1' or
-                    linkId == 'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1'):
+            if (linkId in ('ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1',
+                           'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1')):
                 self.assertEqual(link['org-openroadm-otn-network-topology:available-bandwidth'], 90000)
                 self.assertEqual(link['org-openroadm-otn-network-topology:used-bandwidth'], 10000)
 
@@ -763,7 +764,7 @@ class TransportPCEtesting(unittest.TestCase):
                     if tp['tp-id'] == 'XPDR1-NETWORK1':
                         xpdrTpPortConAt = tp['org-openroadm-otn-network-topology:xpdr-tp-port-connection-attributes']
                         self.assertEqual(len(xpdrTpPortConAt['ts-pool']), 72)
-                        tsPoolList = [i for i in range(1, 9)]
+                        tsPoolList = list(range(1, 9))
                         self.assertNotIn(tsPoolList, xpdrTpPortConAt['ts-pool'])
                         self.assertEqual(len(xpdrTpPortConAt['odtu-tpn-pool'][0]['tpn-pool']), 79)
                         self.assertNotIn(1, xpdrTpPortConAt['odtu-tpn-pool'][0]['tpn-pool'])
@@ -810,8 +811,8 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(nb_links, 4)
         for link in res['network'][0]['ietf-network-topology:link']:
             linkId = link['link-id']
-            if (linkId == 'ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1' or
-                    linkId == 'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1'):
+            if (linkId in ('ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1',
+                           'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1')):
                 self.assertEqual(link['org-openroadm-otn-network-topology:available-bandwidth'], 100000)
                 self.assertEqual(link['org-openroadm-otn-network-topology:used-bandwidth'], 0)
 
index ee670fd140c9216f5a08d1a4d98f5d0ccc7f1847..b8fd458acbfb484fc102e0bb7bdf61204caf26db 100644 (file)
@@ -29,6 +29,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index be4c5e7a71d851fef07bdd8b552f9bb78244c973..26054626b8946035c19101c71bd9efa4ba35b846 100644 (file)
@@ -29,6 +29,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index 751e9399fa921509abcd567d3913f0bb7eeec4d5..bc2c28a901014c22e419add735a2d36a0cdca4ec 100644 (file)
@@ -30,6 +30,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
@@ -77,6 +78,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertNotIn('ietf-network-topology:link', res['network'][0])
 
     def test_05_getNodes_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         res = response.json()
         # Tests related to nodes
@@ -138,6 +140,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertNotIn('ietf-network-topology:link', res['network'][0])
 
     def test_07_getNodes_OtnTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_otn_topo_request()
         res = response.json()
         self.assertEqual(response.status_code, requests.codes.ok)
index 58db3fca60837816b1bd523fe2614d569ea9b880..7692c3246168bb75a9336832da361ce39558f1c2 100644 (file)
@@ -29,6 +29,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index adb7a89a168cc6ad74f4724807e8596d62acbd4e..83fb148226e3bfb60a24fdf3cca7d9f2b3cc4898 100644 (file)
@@ -29,6 +29,7 @@ class TransportPCERendererTesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index 9622da91b64f258a80e5f085190874a9b5657036..496a33e65d88d38f5eccd6a35b460f9e424cc340 100644 (file)
@@ -10,6 +10,9 @@
 
 # pylint: disable=no-member
 # pylint: disable=too-many-public-methods
+# some pylint false positives specific to tapi test
+# pylint: disable=unsubscriptable-object
+# pylint: disable=unsupported-assignment-operation
 
 import os
 import sys
@@ -54,6 +57,7 @@ class TransportTapitesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index d74b42d1982ba5319c8dbf50ede8a9bb4eb9caef..66c0c23d328fb0c271dd87877a6942e735e8472b 100644 (file)
@@ -29,6 +29,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
index 7ec1885b823860d270c9578dbbba90199fe77ca7..936ccfc5d4761b5bed7fc2004211f32ff7facd5d 100644 (file)
@@ -11,6 +11,7 @@
 
 # pylint: disable=no-member
 # pylint: disable=too-many-public-methods
+# pylint: disable=too-many-lines
 
 import unittest
 import time
@@ -30,6 +31,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
@@ -60,6 +62,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(res['network'][0]['node'][0]['org-openroadm-network:model'], 'model2')
 
     def test_04_getLinks_OpenroadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
@@ -100,6 +103,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(len(dropLink), 0)
 
     def test_05_getNodes_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         res = response.json()
         # Tests related to nodes
@@ -178,6 +182,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(res['network'][0]['node'][0]['org-openroadm-clli-network:clli'], 'NodeA')
 
     def test_08_getOpenRoadmNetwork(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_net_request()
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
@@ -197,6 +202,7 @@ class TransportPCEtesting(unittest.TestCase):
                 self.assertFalse(True)
 
     def test_09_getNodes_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         res = response.json()
         # Tests related to nodes
@@ -294,6 +300,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(response.status_code, requests.codes.ok)
 
     def test_12_getLinks_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
@@ -392,6 +399,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(len(listNode), 0)
 
     def test_17_getOpenRoadmNetwork(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_net_request()
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
@@ -421,6 +429,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(len(listNode), 0)
 
     def test_18_getROADMLinkOpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
@@ -500,13 +509,14 @@ class TransportPCEtesting(unittest.TestCase):
                     'org-openroadm-network-topology:OMS-attributes']['span']["engineered-spanloss"]
                 length = res['network'][0]['ietf-network-topology:link'][i][
                     'org-openroadm-network-topology:OMS-attributes']['span']['link-concatenation'][0]['SRLG-length']
-                if (spanLoss != None) & (length != None):
+                if (spanLoss is not None) & (length is not None):
                     find = True
                 self.assertTrue(find)
                 R2RLink.remove(link_id)
         self.assertEqual(len(R2RLink), 0)
 
     def test_20_getNodes_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         res = response.json()
         # Tests related to nodes
@@ -772,7 +782,7 @@ class TransportPCEtesting(unittest.TestCase):
                     'org-openroadm-network-topology:OMS-attributes']['span']["engineered-spanloss"]
                 length = res['network'][0]['ietf-network-topology:link'][i][
                     'org-openroadm-network-topology:OMS-attributes']['span']['link-concatenation'][0]['SRLG-length']
-                if (spanLoss != None) & (length != None):
+                if (spanLoss is not None) & (length is not None):
                     find = True
                 self.assertTrue(find)
                 R2RLink.remove(link_id)
@@ -859,6 +869,7 @@ class TransportPCEtesting(unittest.TestCase):
 #                                'ROADMC-DEG2-DEG2-CTP-TXRXtoROADMC-DEG1-DEG1-CTP-TXRX')
 
     def test_32_getNodes_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         res = response.json()
         # Tests related to nodes
@@ -979,6 +990,7 @@ class TransportPCEtesting(unittest.TestCase):
             self.assertNotEqual(res['network'][0]['node'][i]['node-id'], 'XPDR-A1')
 
     def test_38_getNodes_OpenRoadmTopology(self):
+        # pylint: disable=redundant-unittest-assert
         response = test_utils.get_ordm_topo_request("")
         res = response.json()
         # Tests related to nodes
diff --git a/tests/transportpce_tests/common/__init__.py b/tests/transportpce_tests/common/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
index 19121f53cdd76b4128b215950b36b2e5b7cf1462..dd26aba7996af0440a37316cef7b3be9dbe45731 100644 (file)
@@ -136,7 +136,7 @@ def install_karaf_feature(feature_name: str):
         "..", "..", "..", "karaf", "target", "assembly", "bin", "client")
     return subprocess.run([executable],
                           input='feature:install ' + feature_name + '\n feature:list | grep tapi \n logout \n',
-                          universal_newlines=True)
+                          universal_newlines=True, check=False)
 
 
 def get_request(url):
@@ -153,11 +153,11 @@ def post_request(url, data):
             data=json.dumps(data),
             headers=TYPE_APPLICATION_JSON,
             auth=(ODL_LOGIN, ODL_PWD))
-    else:
-        return requests.request(
-            "POST", url.format(RESTCONF_BASE_URL),
-            headers=TYPE_APPLICATION_JSON,
-            auth=(ODL_LOGIN, ODL_PWD))
+
+    return requests.request(
+        "POST", url.format(RESTCONF_BASE_URL),
+        headers=TYPE_APPLICATION_JSON,
+        auth=(ODL_LOGIN, ODL_PWD))
 
 
 def post_xmlrequest(url, data):
@@ -167,6 +167,7 @@ def post_xmlrequest(url, data):
             data=data,
             headers=TYPE_APPLICATION_XML,
             auth=(ODL_LOGIN, ODL_PWD))
+    return None
 
 
 def put_request(url, data):
@@ -351,11 +352,11 @@ def service_delete_request(servicename: str,
 
 def service_path_request(operation: str, servicename: str, wavenumber: str, nodes):
     attr = {"renderer:input": {
-            "renderer:service-name": servicename,
-            "renderer:wave-number": wavenumber,
-            "renderer:modulation-format": "qpsk",
-            "renderer:operation": operation,
-            "renderer:nodes": nodes}}
+        "renderer:service-name": servicename,
+        "renderer:wave-number": wavenumber,
+        "renderer:modulation-format": "qpsk",
+        "renderer:operation": operation,
+        "renderer:nodes": nodes}}
     return post_request(URL_SERVICE_PATH, attr)
 
 
@@ -373,8 +374,8 @@ def otn_service_path_request(operation: str, servicename: str, servicerate: str,
 
 def create_ots_oms_request(nodeid: str, lcp: str):
     attr = {"input": {
-            "node-id": nodeid,
-            "logical-connection-point": lcp}}
+        "node-id": nodeid,
+        "logical-connection-point": lcp}}
     return post_request(URL_CREATE_OTS_OMS, attr)
 
 
@@ -409,9 +410,11 @@ def start_honeynode(log_file: str, node_port: str, node_config_file_name: str):
             return subprocess.Popen(
                 [HONEYNODE_EXECUTABLE, node_port, os.path.join(SAMPLES_DIRECTORY, node_config_file_name)],
                 stdout=outfile, stderr=outfile)
+    return None
 
 
 def wait_until_log_contains(log_file, regexp, time_to_wait=20):
+    # pylint: disable=lost-exception
     stringfound = False
     filefound = False
     line = None
@@ -457,4 +460,5 @@ class TimeOut:
         signal.alarm(self.seconds)
 
     def __exit__(self, type, value, traceback):
+        # pylint: disable=W0622
         signal.alarm(0)