diff --git a/NEWS b/NEWS index 7ebbd9ef..3e75b7af 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +Version 1.4.1 +============= + + * Per core CPU stats (if space is available) + Version 1.4 =========== diff --git a/glances/unitest.py b/glances/unitest.py new file mode 100755 index 00000000..8d698b92 --- /dev/null +++ b/glances/unitest.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# +# Glances unitary test +# +# Syntax: +# ./unitest.py +# +# or ./unitest.py -v +# +# Copyright (C) Nicolargo 2012 +# +# under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Glances is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see ."; +# + +import unittest +import glances +import multiprocessing + +class TestGlancesStat(unittest.TestCase): + + def setUp(self): + self.stats = glances.glancesStats() + self.stats.update() + + def test_Glances_getCore(self): + self.assertEqual(self.stats.getCore(), multiprocessing.cpu_count()) + + def test_Glances_getCpu(self): + self.stats.update() + self.assertEqual(len(self.stats.getCpu()), 4) + + def test_Glances_getPerCpu(self): + self.stats.update() + self.assertEqual(len(self.stats.getPerCpu()), multiprocessing.cpu_count()) + + def test_Glances_getMem(self): + self.stats.update() + self.assertTrue(len(self.stats.getMem()) > 2) + + def test_Glances_getMemSwap(self): + self.stats.update() + self.assertTrue(len(self.stats.getMemSwap()) > 2) + + +if __name__ == '__main__': + unittest.main() +