summaryrefslogtreecommitdiffstats
path: root/unitest-restful.py
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2021-08-25 13:07:44 +0200
committernicolargo <nicolas@nicolargo.com>2021-08-25 13:07:44 +0200
commit15173dd431f588c43eb22226920acaf337d2fbc6 (patch)
tree5f479bf039442d29fbeeabfea74f8711fc28b170 /unitest-restful.py
parent83170d7da5beebc715e3e72ff866249886a69ec2 (diff)
Correct unitests
Diffstat (limited to 'unitest-restful.py')
-rwxr-xr-xunitest-restful.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/unitest-restful.py b/unitest-restful.py
index 7b77a2b9..8e9b8655 100755
--- a/unitest-restful.py
+++ b/unitest-restful.py
@@ -3,7 +3,7 @@
#
# Glances - An eye on your system
#
-# Copyright (C) 2019 Nicolargo <nicolas@nicolargo.com>
+# Copyright (C) 2021 Nicolargo <nicolas@nicolargo.com>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
@@ -20,6 +20,7 @@
"""Glances unitary tests suite for the RESTful API."""
+import os
import shlex
import subprocess
import time
@@ -64,7 +65,11 @@ class TestGlances(unittest.TestCase):
global pid
print('INFO: [TEST_000] Start the Glances Web Server')
- cmdline = "python -m glances -w -p %s" % SERVER_PORT
+ if os.path.isfile('./venv/bin/python'):
+ cmdline = "./venv/bin/python"
+ else:
+ cmdline = "python"
+ cmdline += " -m glances -w -p %s" % SERVER_PORT
print("Run the Glances Web Server on port %s" % SERVER_PORT)
args = shlex.split(cmdline)
pid = subprocess.Popen(args)