summaryrefslogtreecommitdiffstats
path: root/unitest.py
diff options
context:
space:
mode:
authorAlessio Sergi <al3hex@gmail.com>2015-09-21 15:39:39 +0200
committerAlessio Sergi <al3hex@gmail.com>2015-09-21 15:39:39 +0200
commit837193ef7bdaf2b37d176cd750235ab0008c2e12 (patch)
tree711c094e10fefc02117185ae43f1f28ed2892e9a /unitest.py
parent168969bdf4c973089e3c59cb5efbc892285154fb (diff)
unitest: unbreak non-Linux platforms
OK FreeBSD, OS X and Windows.
Diffstat (limited to 'unitest.py')
-rwxr-xr-xunitest.py19
1 files changed, 5 insertions, 14 deletions
diff --git a/unitest.py b/unitest.py
index 4e9e876b..f25dfe71 100755
--- a/unitest.py
+++ b/unitest.py
@@ -24,23 +24,9 @@ import sys
import time
import unittest
-from glances.outputs.glances_bars import Bar
-from glances.core.glances_globals import (
- appname,
- is_linux,
- version
-)
-
# Global variables
# =================
-# Unitary test is only available from a GNU/Linus machine
-if not is_linux:
- print('ERROR: 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()
@@ -52,9 +38,13 @@ if not core.is_standalone():
from glances.core.glances_stats import GlancesStats
stats = GlancesStats()
+from glances.core.glances_globals import is_windows, version
+from glances.outputs.glances_bars import Bar
# Unitest class
# ==============
+print('Unitary tests for Glances %s' % version)
+
class TestGlances(unittest.TestCase):
@@ -115,6 +105,7 @@ class TestGlances(unittest.TestCase):
self.assertLessEqual(stats_grab[stat], 100)
print('INFO: CPU stats: %s' % stats_grab)
+ @unittest.skipIf(is_windows, "Load average not available on Windows")
def test_004_load(self):
"""Check LOAD plugin."""
stats_to_check = ['cpucore', 'min1', 'min5', 'min15']