intracom-telecom-sdn/nstat

View on GitHub
util/unittests/test_sysstats.py

Summary

Maintainability
F
5 days
Test Coverage

Showing 12 of 12 total issues

File test_sysstats.py has 312 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (c) 2015 Intracom S.A. Telecom Solutions. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0 which accompanies this distribution,
# and is available at http://www.eclipse.org/legal/epl-v10.html
Severity: Minor
Found in util/unittests/test_sysstats.py - About 3 hrs to fix

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

    def test_totam_ramb(self):
    """Test functionality of sysstats.sys_total_memory_bytes function
    """
     
    var = util.sysstats.sys_total_memory_bytes()
    Severity: Major
    Found in util/unittests/test_sysstats.py and 5 other locations - About 5 hrs to fix
    util/unittests/test_sysstats.py on lines 51..60
    util/unittests/test_sysstats.py on lines 62..71
    util/unittests/test_sysstats.py on lines 73..82
    util/unittests/test_sysstats.py on lines 84..93
    util/unittests/test_sysstats.py on lines 133..141

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

    def test_used_ram(self):
    """Test functionality of sysstats.sys_free_ram_mb function.
    """
     
    var = util.sysstats.sys_used_ram_mb()
    Severity: Major
    Found in util/unittests/test_sysstats.py and 5 other locations - About 5 hrs to fix
    util/unittests/test_sysstats.py on lines 62..71
    util/unittests/test_sysstats.py on lines 73..82
    util/unittests/test_sysstats.py on lines 84..93
    util/unittests/test_sysstats.py on lines 95..104
    util/unittests/test_sysstats.py on lines 133..141

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

    def test_used_ramb(self):
    """Test functionality of sysstats.sys_used_memory_bytes function
    """
     
    var = util.sysstats.sys_used_memory_bytes()
    Severity: Major
    Found in util/unittests/test_sysstats.py and 5 other locations - About 5 hrs to fix
    util/unittests/test_sysstats.py on lines 51..60
    util/unittests/test_sysstats.py on lines 62..71
    util/unittests/test_sysstats.py on lines 84..93
    util/unittests/test_sysstats.py on lines 95..104
    util/unittests/test_sysstats.py on lines 133..141

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

    def test_free_ramb(self):
    """Test functionality of sysstats.sys_free_memory_bytes function
    """
     
    var = util.sysstats.sys_free_memory_bytes()
    Severity: Major
    Found in util/unittests/test_sysstats.py and 5 other locations - About 5 hrs to fix
    util/unittests/test_sysstats.py on lines 51..60
    util/unittests/test_sysstats.py on lines 62..71
    util/unittests/test_sysstats.py on lines 73..82
    util/unittests/test_sysstats.py on lines 95..104
    util/unittests/test_sysstats.py on lines 133..141

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

    def test_free_ram(self):
    """Test functionality of sysstats.sys_free_ram_mb function
    """
     
    var = util.sysstats.sys_free_ram_mb()
    Severity: Major
    Found in util/unittests/test_sysstats.py and 5 other locations - About 5 hrs to fix
    util/unittests/test_sysstats.py on lines 51..60
    util/unittests/test_sysstats.py on lines 73..82
    util/unittests/test_sysstats.py on lines 84..93
    util/unittests/test_sysstats.py on lines 95..104
    util/unittests/test_sysstats.py on lines 133..141

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

    def test_io_error(self):
    """Test functionality of sysstats.sys_iowait_time function
    """
    var = util.sysstats.sys_iowait_time()
    self.assertTrue((var > 0) and isinstance(var, float),
    Severity: Major
    Found in util/unittests/test_sysstats.py and 5 other locations - About 5 hrs to fix
    util/unittests/test_sysstats.py on lines 51..60
    util/unittests/test_sysstats.py on lines 62..71
    util/unittests/test_sysstats.py on lines 73..82
    util/unittests/test_sysstats.py on lines 84..93
    util/unittests/test_sysstats.py on lines 95..104

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

    def test_vm_size(self):
    """Test functionality of sysstats.proc_vm_size function
    """
     
    self.assertTrue(isinstance(util.sysstats.proc_vm_size(
    Severity: Major
    Found in util/unittests/test_sysstats.py and 1 other location - About 3 hrs to fix
    util/unittests/test_sysstats.py on lines 205..217

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

    def test_cpu_system_time(self):
    """Test functionality of sysstats.proc_cpu_system_time function
    """
     
    self.assertTrue(
    Severity: Major
    Found in util/unittests/test_sysstats.py and 1 other location - About 3 hrs to fix
    util/unittests/test_sysstats.py on lines 219..227

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

    cls.exit_status, cls.sleep_pid_remote = util.netutil.ssh_run_command(
    cls.ssh_client, 'cat $HOME/sleep_pid.txt', prefix='',
    Severity: Major
    Found in util/unittests/test_sysstats.py and 2 other locations - About 50 mins to fix
    util/unittests/test_sysstats.py on lines 177..178
    util/unittests/test_sysstats.py on lines 279..280

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

    cls.exit_status, cls.cur_dir_remote = util.netutil.ssh_run_command(
    cls.ssh_client, 'pwd', prefix='', lines_queue=None,
    Severity: Major
    Found in util/unittests/test_sysstats.py and 2 other locations - About 50 mins to fix
    util/unittests/test_sysstats.py on lines 173..174
    util/unittests/test_sysstats.py on lines 279..280

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

    cls.exit_status, cls.sleep_pid_remote = util.netutil.ssh_run_command(
    cls.ssh_client, 'cat $HOME/sleep_pid.txt', prefix='',
    Severity: Major
    Found in util/unittests/test_sysstats.py and 2 other locations - About 50 mins to fix
    util/unittests/test_sysstats.py on lines 173..174
    util/unittests/test_sysstats.py on lines 177..178

    There are no issues that match your filters.

    Category
    Status