summaryrefslogtreecommitdiffstats
path: root/unitest-restful.py
diff options
context:
space:
mode:
authorAlessio Sergi <al3hex@gmail.com>2015-09-22 12:12:12 +0200
committerAlessio Sergi <al3hex@gmail.com>2015-09-22 12:12:12 +0200
commit075ba72d79c6fb1a7b5f51e731273f4ddde1e35c (patch)
treebd29bda3b3b4099dc8d101f4909b340a9a1cfd0d /unitest-restful.py
parent3db98fb9a1d0e8508400e973cee799931cc981e4 (diff)
unitest-restful: unbreak non-Linux platforms
OK FreeBSD, OS X and Windows.
Diffstat (limited to 'unitest-restful.py')
-rwxr-xr-xunitest-restful.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/unitest-restful.py b/unitest-restful.py
index cdb90e69..35df5375 100755
--- a/unitest-restful.py
+++ b/unitest-restful.py
@@ -28,11 +28,7 @@ import subprocess
import requests
import json
-from glances.core.glances_globals import (
- appname,
- is_linux,
- version
-)
+from glances.core.glances_globals import version
SERVER_PORT = 61234
URL = "http://localhost:%s/api/2" % SERVER_PORT
@@ -41,14 +37,6 @@ pid = None
# Global variables
# =================
-# Unitary test is only available from a GNU/Linus machine
-if not is_linux:
- print(
- 'ERROR: RESTFul API unitaries tests should be ran on GNU/Linux operating system')
- sys.exit(2)
-else:
- print('Unitary tests for {0} {1}'.format(appname, version))
-
# Init Glances core
from glances.core.glances_main import GlancesMain
core = GlancesMain()
@@ -63,6 +51,8 @@ stats = GlancesStats()
# Unitest class
# ==============
+print('RESTful API unitary tests for Glances %s' % version)
+
class TestGlances(unittest.TestCase):
@@ -78,7 +68,7 @@ class TestGlances(unittest.TestCase):
global pid
- cmdline = "/usr/bin/env python -m glances -w -p %s" % SERVER_PORT
+ cmdline = "python -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)