Code Duplication    Length = 17-17 lines in 2 locations

unittest-restful.py 1 location

@@ 54-70 (lines=17) @@
51
                               headers={'Accept-encoding': 'identity'})
52
        return ret
53
54
    def test_000_start_server(self):
55
        """Start the Glances Web Server."""
56
        global pid
57
58
        print('INFO: [TEST_000] Start the Glances Web Server API')
59
        if os.path.isfile('./venv/bin/python'):
60
            cmdline = "./venv/bin/python"
61
        else:
62
            cmdline = "python"
63
        cmdline += " -m glances -B 0.0.0.0 -w -p %s --disable-webui -C ./conf/glances.conf" % SERVER_PORT
64
        print("Run the Glances Web Server on port %s" % SERVER_PORT)
65
        args = shlex.split(cmdline)
66
        pid = subprocess.Popen(args)
67
        print("Please wait 5 seconds...")
68
        time.sleep(5)
69
70
        self.assertTrue(pid is not None)
71
72
    def test_001_all(self):
73
        """All."""

unittest-xmlrpc.py 1 location

@@ 42-58 (lines=17) @@
39
        """The function is called *every time* before test_*."""
40
        print('\n' + '=' * 78)
41
42
    def test_000_start_server(self):
43
        """Start the Glances Web Server."""
44
        global pid
45
46
        print('INFO: [TEST_000] Start the Glances Web Server')
47
        if os.path.isfile('./venv/bin/python'):
48
            cmdline = "./venv/bin/python"
49
        else:
50
            cmdline = "python"
51
        cmdline += " -m glances -B localhost -s -p %s" % SERVER_PORT
52
        print("Run the Glances Server on port %s" % SERVER_PORT)
53
        args = shlex.split(cmdline)
54
        pid = subprocess.Popen(args)
55
        print("Please wait...")
56
        time.sleep(1)
57
58
        self.assertTrue(pid is not None)
59
60
    def test_001_all(self):
61
        """All."""