Code Duplication    Length = 17-17 lines in 2 locations

tests/test_xmlrpc.py 1 location

@@ 51-67 (lines=17) @@
48
        """The function is called *every time* before test_*."""
49
        print('\n' + '=' * 78)
50
51
    def test_000_start_server(self):
52
        """Start the Glances Web Server."""
53
        global pid
54
55
        print('INFO: [TEST_000] Start the Glances Web Server')
56
        if os.path.isfile('./venv/bin/python'):
57
            cmdline = "./venv/bin/python"
58
        else:
59
            cmdline = "python"
60
        cmdline += f" -m glances -B localhost -s -p {SERVER_PORT}"
61
        print(f"Run the Glances Server on port {SERVER_PORT}")
62
        args = shlex.split(cmdline)
63
        pid = subprocess.Popen(args)
64
        print("Please wait...")
65
        time.sleep(1)
66
67
        self.assertTrue(pid is not None)
68
69
    def test_001_all(self):
70
        """All."""

tests/test_restful.py 1 location

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