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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/psutil/test/_bsd.py ('k') | third_party/psutil/test/_osx.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/psutil/test/_linux.py
diff --git a/third_party/psutil/test/_linux.py b/third_party/psutil/test/_linux.py
new file mode 100644
index 0000000000000000000000000000000000000000..187c058a4843735a7567002e886b8ebf38738f0f
--- /dev/null
+++ b/third_party/psutil/test/_linux.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+#
+# $Id: _linux.py 707 2010-10-19 18:16:08Z g.rodola $
+#
+
+import unittest
+import subprocess
+import sys
+
+import psutil
+
+
+class LinuxSpecificTestCase(unittest.TestCase):
+
+ def test_cached_phymem(self):
+ # test psutil.cached_phymem against "cached" column of free
+ # command line utility
+ p = subprocess.Popen("free", shell=1, stdout=subprocess.PIPE)
+ output = p.communicate()[0].strip()
+ if sys.version_info >= (3,):
+ output = str(output, sys.stdout.encoding)
+ free_cmem = int(output.split('\n')[1].split()[6])
+ psutil_cmem = psutil.cached_phymem() / 1024
+ self.assertEqual(free_cmem, psutil_cmem)
+
+ def test_phymem_buffers(self):
+ # test psutil.phymem_buffers against "buffers" column of free
+ # command line utility
+ p = subprocess.Popen("free", shell=1, stdout=subprocess.PIPE)
+ output = p.communicate()[0].strip()
+ if sys.version_info >= (3,):
+ output = str(output, sys.stdout.encoding)
+ free_cmem = int(output.split('\n')[1].split()[5])
+ psutil_cmem = psutil.phymem_buffers() / 1024
+ self.assertEqual(free_cmem, psutil_cmem)
+
+
+if __name__ == '__main__':
+ test_suite = unittest.TestSuite()
+ test_suite.addTest(unittest.makeSuite(LinuxSpecificTestCase))
+ unittest.TextTestRunner(verbosity=2).run(test_suite)
+
+
+
+
« 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