intracom-telecom-sdn/nstat

View on GitHub
util/unittests/test_process.py

Summary

Maintainability
C
1 day
Test Coverage

Showing 8 of 8 total issues

Cyclomatic complexity is too high in method setUpClass. (7)
Open

@classmethod
def setUpClass(cls):
"""Initializes the testing environment parameters. Starts
the server process
"""
Severity: Minor
Found in util/unittests/test_process.py by radon

Function setUpClass has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def setUpClass(cls):
"""Initializes the testing environment parameters. Starts
the server process
"""
cls.LISTEN_PORT = 65535
Severity: Minor
Found in util/unittests/test_process.py - About 35 mins to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def test_getpid_listeningonport_03(self):
"""Checks the getpid_listeningonport() function of
util/process.py module. In this scenario we check the result in case
we give as input to the function something that is not a port number.
"""
Severity: Major
Found in util/unittests/test_process.py and 1 other location - About 2 hrs to fix
util/unittests/test_process.py on lines 119..133

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def test_getpid_listeningonport_02(self):
"""Checks the getpid_listeningonport() function of
util/process.py module. In this scenario we check the result in case
we give as input to the function, a port number on which a process
that the user not owns is listening.
Severity: Major
Found in util/unittests/test_process.py and 1 other location - About 2 hrs to fix
util/unittests/test_process.py on lines 135..148

Similar blocks of code found in 5 locations. Consider refactoring.
Open

if __name__ == '__main__':
SUITE_PROCESSTESTALLFUNCTIONS = unittest.TestLoader().\
loadTestsFromTestCase(ProcessTestAllFunctions)
unittest.TextTestRunner(verbosity=2).run(SUITE_PROCESSTESTALLFUNCTIONS)
Severity: Major
Found in util/unittests/test_process.py and 4 other locations - About 1 hr to fix
util/unittests/test_file.py on lines 116..119
util/unittests/test_netutil.py on lines 168..170
util/unittests/test_plot_json.py on lines 107..110
util/unittests/test_stats.py on lines 46..49

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def test_is_process_running_01(self):
"""Checks the is_process_running() function of
util/process.py module. In this scenario we check the result in case
we give as input to the function a valid process id.
"""
Severity: Minor
Found in util/unittests/test_process.py and 1 other location - About 30 mins to fix
util/unittests/test_process.py on lines 161..170

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def test_is_process_running_02(self):
"""Checks the is_process_running() function of
util/process.py module. In this scenario we check the result in case
we give as input to the function a invalid process id.
"""
Severity: Minor
Found in util/unittests/test_process.py and 1 other location - About 30 mins to fix
util/unittests/test_process.py on lines 150..159

Similar blocks of code found in 5 locations. Consider refactoring.
Open

def test_getpid_listeningonport_01(self):
"""Checks the getpid_listeningonport() function of
util/process.py module. Checks the equality between the known process
id of the initializes server, with the one returned from the function.
"""
Severity: Major
Found in util/unittests/test_process.py and 4 other locations - About 30 mins to fix
util/unittests/test_html.py on lines 26..34
util/unittests/test_html.py on lines 65..73
util/unittests/test_html.py on lines 251..261
util/unittests/test_stats.py on lines 31..37
Category
Status