diff options
author | nicolargo <nicolas@nicolargo.com> | 2022-10-31 08:40:46 +0100 |
---|---|---|
committer | nicolargo <nicolas@nicolargo.com> | 2022-10-31 08:40:46 +0100 |
commit | 2b8ae361d1d3b4239e29ac46bee727d013df5797 (patch) | |
tree | e3aeefbf73b1d5f3e20bdf2da5d3431df6a330eb /unitest-restful.py | |
parent | 9758d18db17ff32ebb5f44b37d63783fa04845d6 (diff) |
Improve unitary test for client/server by using venv if possible
Diffstat (limited to 'unitest-restful.py')
-rwxr-xr-x | unitest-restful.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/unitest-restful.py b/unitest-restful.py index df64cf99..362fce61 100755 --- a/unitest-restful.py +++ b/unitest-restful.py @@ -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) |