From c36da6a78edacc4ce684d8d435ba33b316f35f62 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Wed, 15 Jul 2015 14:21:13 +0200 Subject: [PATCH] #656 fix test --- test/test_psutil.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/test_psutil.py b/test/test_psutil.py index 0ec756f65..3df30203b 100644 --- a/test/test_psutil.py +++ b/test/test_psutil.py @@ -2747,7 +2747,8 @@ def test_process__hash__(self): self.assertEqual(len(s), 1) def test__all__(self): - for name in dir(psutil): + dir_psutil = dir(psutil) + for name in dir_psutil: if name in ('callable', 'error', 'namedtuple', 'long', 'test', 'NUM_CPUS', 'BOOT_TIME', 'TOTAL_PHYMEM'): @@ -2763,9 +2764,13 @@ def test__all__(self): if (fun.__doc__ is not None and 'deprecated' not in fun.__doc__.lower()): self.fail('%r not in psutil.__all__' % name) - # import 'star' will break if __all__ is inconsistent, see: + + # Import 'star' will break if __all__ is inconsistent, see: # https://github.com/giampaolo/psutil/issues/656 - from psutil import * # NOQA + # Can't do `from psutil import *` as it won't work on python 3 + # so we simply iterate over __all__. + for name in psutil.__all__: + self.assertIn(name, dir_psutil) def test_memoize(self): from psutil._common import memoize