mirror of https://github.com/nicolargo/glances.git
Improve unitary test for client/server by using venv if possible
This commit is contained in:
parent
9758d18db1
commit
2b8ae361d1
|
|
@ -15,6 +15,7 @@ import subprocess
|
|||
import time
|
||||
import numbers
|
||||
import unittest
|
||||
import os
|
||||
|
||||
from glances import __version__
|
||||
from glances.compat import text_type
|
||||
|
|
@ -54,7 +55,11 @@ class TestGlances(unittest.TestCase):
|
|||
global pid
|
||||
|
||||
print('INFO: [TEST_000] Start the Glances Web Server')
|
||||
cmdline = "python -m glances -B localhost -w -p %s" % SERVER_PORT
|
||||
if os.path.isfile("./venv/bin/python"):
|
||||
cmdline = "./venv/bin/python"
|
||||
else:
|
||||
cmdline = "python"
|
||||
cmdline += " -m glances -B localhost -w -p %s" % SERVER_PORT
|
||||
print("Run the Glances Web Server on port %s" % SERVER_PORT)
|
||||
args = shlex.split(cmdline)
|
||||
pid = subprocess.Popen(args)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import shlex
|
|||
import subprocess
|
||||
import time
|
||||
import unittest
|
||||
import os
|
||||
|
||||
from glances import __version__
|
||||
from glances.compat import ServerProxy
|
||||
|
|
@ -43,7 +44,11 @@ class TestGlances(unittest.TestCase):
|
|||
global pid
|
||||
|
||||
print('INFO: [TEST_000] Start the Glances Web Server')
|
||||
cmdline = "python -m glances -B localhost -s -p %s" % SERVER_PORT
|
||||
if os.path.isfile("./venv/bin/python"):
|
||||
cmdline = "./venv/bin/python"
|
||||
else:
|
||||
cmdline = "python"
|
||||
cmdline += " -m glances -B localhost -s --disable-autodiscover -p %s" % SERVER_PORT
|
||||
print("Run the Glances Server on port %s" % SERVER_PORT)
|
||||
args = shlex.split(cmdline)
|
||||
pid = subprocess.Popen(args)
|
||||
|
|
|
|||
Loading…
Reference in New Issue