Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/psutil/tests/test_sunos.py @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author | shellac |
---|---|
date | Sat, 02 May 2020 07:14:21 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:26e78fe6e8c4 |
---|---|
1 #!/usr/bin/env python3 | |
2 | |
3 # Copyright (c) 2009, Giampaolo Rodola'. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
7 """Sun OS specific tests.""" | |
8 | |
9 import os | |
10 | |
11 import psutil | |
12 from psutil import SUNOS | |
13 from psutil.tests import sh | |
14 from psutil.tests import unittest | |
15 | |
16 | |
17 @unittest.skipIf(not SUNOS, "SUNOS only") | |
18 class SunOSSpecificTestCase(unittest.TestCase): | |
19 | |
20 def test_swap_memory(self): | |
21 out = sh('env PATH=/usr/sbin:/sbin:%s swap -l' % os.environ['PATH']) | |
22 lines = out.strip().split('\n')[1:] | |
23 if not lines: | |
24 raise ValueError('no swap device(s) configured') | |
25 total = free = 0 | |
26 for line in lines: | |
27 line = line.split() | |
28 t, f = line[-2:] | |
29 total += int(int(t) * 512) | |
30 free += int(int(f) * 512) | |
31 used = total - free | |
32 | |
33 psutil_swap = psutil.swap_memory() | |
34 self.assertEqual(psutil_swap.total, total) | |
35 self.assertEqual(psutil_swap.used, used) | |
36 self.assertEqual(psutil_swap.free, free) | |
37 | |
38 def test_cpu_count(self): | |
39 out = sh("/usr/sbin/psrinfo") | |
40 self.assertEqual(psutil.cpu_count(), len(out.split('\n'))) | |
41 | |
42 | |
43 if __name__ == '__main__': | |
44 from psutil.tests.runner import run | |
45 run(__file__) |