Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(691)

Side by Side Diff: third_party/psutil/test/_linux.py

Issue 6246123: Moving psutil to third_party. This is first step for Media Performance test project. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: modification based on code review's comments Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/psutil/test/_bsd.py ('k') | third_party/psutil/test/_osx.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # $Id: _linux.py 707 2010-10-19 18:16:08Z g.rodola $
4 #
5
6 import unittest
7 import subprocess
8 import sys
9
10 import psutil
11
12
13 class LinuxSpecificTestCase(unittest.TestCase):
14
15 def test_cached_phymem(self):
16 # test psutil.cached_phymem against "cached" column of free
17 # command line utility
18 p = subprocess.Popen("free", shell=1, stdout=subprocess.PIPE)
19 output = p.communicate()[0].strip()
20 if sys.version_info >= (3,):
21 output = str(output, sys.stdout.encoding)
22 free_cmem = int(output.split('\n')[1].split()[6])
23 psutil_cmem = psutil.cached_phymem() / 1024
24 self.assertEqual(free_cmem, psutil_cmem)
25
26 def test_phymem_buffers(self):
27 # test psutil.phymem_buffers against "buffers" column of free
28 # command line utility
29 p = subprocess.Popen("free", shell=1, stdout=subprocess.PIPE)
30 output = p.communicate()[0].strip()
31 if sys.version_info >= (3,):
32 output = str(output, sys.stdout.encoding)
33 free_cmem = int(output.split('\n')[1].split()[5])
34 psutil_cmem = psutil.phymem_buffers() / 1024
35 self.assertEqual(free_cmem, psutil_cmem)
36
37
38 if __name__ == '__main__':
39 test_suite = unittest.TestSuite()
40 test_suite.addTest(unittest.makeSuite(LinuxSpecificTestCase))
41 unittest.TextTestRunner(verbosity=2).run(test_suite)
42
43
44
45
OLDNEW
« no previous file with comments | « third_party/psutil/test/_bsd.py ('k') | third_party/psutil/test/_osx.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698