summaryrefslogtreecommitdiffstats
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
parent83170d7da5beebc715e3e72ff866249886a69ec2 (diff)
Correct unitests
-rw-r--r--glances/compat.py2
-rwxr-xr-xunitest-restful.py9
-rwxr-xr-xunitest-xmlrpc.py7
-rwxr-xr-xunitest.py2
4 files changed, 15 insertions, 5 deletions
diff --git a/glances/compat.py b/glances/compat.py
index 4c788482..58952fc2 100644
--- a/glances/compat.py
+++ b/glances/compat.py
@@ -2,7 +2,7 @@
#
# This file is part of Glances.
#
-# 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
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)
diff --git a/unitest-xmlrpc.py b/unitest-xmlrpc.py
index 7e52ec5e..69918047 100755
--- a/unitest-xmlrpc.py
+++ b/unitest-xmlrpc.py
@@ -20,6 +20,7 @@
"""Glances unitary tests suite for the XML-RPC API."""
+import os
import json
import shlex
import subprocess
@@ -53,7 +54,11 @@ class TestGlances(unittest.TestCase):
global pid
print('INFO: [TEST_000] Start the Glances Web Server')
- cmdline = "python -m glances -s -p %s" % SERVER_PORT
+ if os.path.isfile('./venv/bin/python'):
+ cmdline = "./venv/bin/python"
+ else:
+ cmdline = "python"
+ cmdline += " -m glances -s -p %s" % SERVER_PORT
print("Run the Glances Server on port %s" % SERVER_PORT)
args = shlex.split(cmdline)
pid = subprocess.Popen(args)
diff --git a/unitest.py b/unitest.py
index 750c0111..2543dc73 100755
--- a/unitest.py
+++ b/unitest.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