From c17749b70584148284823591f7fa4f8bd4a7d05a Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Thu, 21 Jan 2016 10:11:21 +0100 Subject: improve test --- HISTORY.rst | 1 + setup.py | 1 + test/_linux.py | 4 +++- test/test_psutil.py | 6 +++--- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index d715fb08..f39478d6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -11,6 +11,7 @@ Bug tracker at https://github.com/giampaolo/psutil/issues **Bug fixes** +- #724: [FreeBSD] psutil.virtual_memory().total is incorrect. - #730: [FreeBSD] psutil.virtual_memory() crashes. diff --git a/setup.py b/setup.py index fb85a8fb..4d4d8650 100644 --- a/setup.py +++ b/setup.py @@ -261,6 +261,7 @@ def main(): 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Programming Language :: Python', diff --git a/test/_linux.py b/test/_linux.py index 0ca9049c..ff533e9b 100644 --- a/test/_linux.py +++ b/test/_linux.py @@ -490,7 +490,8 @@ class LinuxSpecificTestCase(unittest.TestCase): psutil.PROCFS_PATH = "/proc" os.rmdir(tdir) - def test_no_procfs_for_import(self): + @mock.patch('psutil.traceback.print_exc') + def test_no_procfs_for_import(self, tb): my_procfs = tempfile.mkdtemp() with open(os.path.join(my_procfs, 'stat'), 'w') as f: @@ -509,6 +510,7 @@ class LinuxSpecificTestCase(unittest.TestCase): patch_point = 'builtins.open' if PY3 else '__builtin__.open' with mock.patch(patch_point, side_effect=open_mock): importlib.reload(psutil) + assert tb.called self.assertRaises(IOError, psutil.cpu_times) self.assertRaises(IOError, psutil.cpu_times, percpu=True) diff --git a/test/test_psutil.py b/test/test_psutil.py index 3fe71317..c2c70fec 100644 --- a/test/test_psutil.py +++ b/test/test_psutil.py @@ -3061,6 +3061,9 @@ class TestMisc(unittest.TestCase): psutil.Process() assert meth.called + def test_psutil_is_reloadable(self): + importlib.reload(psutil) + # =================================================================== # --- Example script tests @@ -3227,9 +3230,6 @@ class TestUnicode(unittest.TestCase): self.assertIsInstance(path, str) self.assertEqual(os.path.normcase(path), os.path.normcase(self.uexe)) - def test_psutil_is_reloadable(self): - importlib.reload(psutil) - def main(): tests = [] -- cgit v1.2.1