summaryrefslogtreecommitdiffstats
path: root/unitest-xmlrpc.py
diff options
context:
space:
mode:
authorAlessio Sergi <al3hex@gmail.com>2015-09-21 19:09:09 +0200
committerAlessio Sergi <al3hex@gmail.com>2015-09-21 19:09:09 +0200
commit8ad7af69160e72fbe70ffc7426e487fcb83a907c (patch)
treefcfe7010f358c559e9d78c3c5ee7fb1b3f0ffe32 /unitest-xmlrpc.py
parentc513fe6fb580b2fcdb7f3f9c645d2da903aa632b (diff)
unitest-xmlrpc: unbreak non-Linux platforms
OK FreeBSD, OS X and Windows.
Diffstat (limited to 'unitest-xmlrpc.py')
-rwxr-xr-xunitest-xmlrpc.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/unitest-xmlrpc.py b/unitest-xmlrpc.py
index eba2a4b9..1ba2bcc7 100755
--- a/unitest-xmlrpc.py
+++ b/unitest-xmlrpc.py
@@ -32,12 +32,6 @@ except ImportError:
# Python 2
from xmlrpclib import ServerProxy
-from glances.core.glances_globals import (
- appname,
- is_linux,
- version
-)
-
SERVER_PORT = 61234
URL = "http://localhost:%s" % SERVER_PORT
pid = None
@@ -45,14 +39,6 @@ pid = None
# Global variables
# =================
-# Unitary test is only available from a GNU/Linus machine
-if not is_linux:
- print(
- 'ERROR: XML/RPC 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()
@@ -64,12 +50,14 @@ if not core.is_standalone():
from glances.core.glances_stats import GlancesStats
stats = GlancesStats()
+from glances.core.glances_globals import version
+
# Init the XML/RCP client
client = ServerProxy(URL)
# Unitest class
# ==============
-
+print('XML-RPC API unitary tests for Glances %s' % version)
class TestGlances(unittest.TestCase):
@@ -85,7 +73,7 @@ class TestGlances(unittest.TestCase):
global pid
- cmdline = "/usr/bin/env python -m glances -s -p %s" % SERVER_PORT
+ cmdline = "python -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)