diff options
author | Adrian Page <adrian@pagenet.plus.com> | 2017-10-28 18:40:29 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-10-28 19:40:29 +0200 |
commit | 5c51581f1ea80b3d3ab5652ac0d904f8cb65fd77 (patch) | |
tree | f5adf633c852e123585a6d78829e1a59692910f9 | |
parent | 3cec63006e0f3f3498862310268d2ca6e21af39d (diff) | |
download | psutil-5c51581f1ea80b3d3ab5652ac0d904f8cb65fd77.tar.gz |
Fix test asserts due to leftover test subprocesses (#1161)
* Reap test subprocess.
The leftover child process was triggering an assert in a later test:
======================================================================
FAIL: psutil.tests.test_connections.TestConnectedSocketPairs.test_combos
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ade/projects/psutil/psutil/tests/__init__.py", line 792, in wrapper
return fun(*args, **kwargs)
File "/home/ade/projects/psutil/psutil/tests/test_connections.py", line 330, in test_combos
self.assertEqual(len(cons), 1)
AssertionError: 0 != 1
* Inherit from Base so that reap_children() cleans up the test processes.
Fixes memory leak test asserts.
psutil/tests/test_memory_leaks.py:334:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
psutil/tests/test_memory_leaks.py:125: in execute
self.assertEqual(thisproc.children(), [])
E AssertionError: Lists differ: [<psutil.Process(pid=908, name... != []
E
E First list contains 10 additional elements.
E First extra element 0:
E <psutil.Process(pid=908, name='python2.7') at 34513317008>
E
E + []
E - [<psutil.Process(pid=908, name='python2.7') at 34513317008>,
E - <psutil.Process(pid=909, name='python2.7') at 34459063760>,
E - <psutil.Process(pid=910, name='python2.7') at 34459064464>,
E - <psutil.Process(pid=911, name='python2.7') at 34513749456>,
E - <psutil.Process(pid=912, name='python2.7') at 34513749520>,
E - <psutil.Process(pid=913, name='python2.7') at 34513751184>,
E - <psutil.Process(pid=914, name='python2.7') at 34513751120>,
E - <psutil.Process(pid=915, name='python2.7') at 34513751312>,
E - <psutil.Process(pid=916, name='python2.7') at 34513751376>,
E - <psutil.Process(pid=917, name='python2.7') at 34513748176>]
-rwxr-xr-x | psutil/tests/test_connections.py | 2 | ||||
-rwxr-xr-x | psutil/tests/test_unicode.py | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/psutil/tests/test_connections.py b/psutil/tests/test_connections.py index 203ddebb..d248af57 100755 --- a/psutil/tests/test_connections.py +++ b/psutil/tests/test_connections.py @@ -418,7 +418,7 @@ class TestConnectedSocketPairs(Base, unittest.TestCase): # ===================================================================== -class TestSystemWideConnections(unittest.TestCase): +class TestSystemWideConnections(Base, unittest.TestCase): """Tests for net_connections().""" @skip_on_access_denied() diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py index 2aa75221..4e2289bf 100755 --- a/psutil/tests/test_unicode.py +++ b/psutil/tests/test_unicode.py @@ -352,6 +352,7 @@ class TestNonFSAPIS(unittest.TestCase): self.assertIsInstance(k, str) self.assertIsInstance(v, str) self.assertEqual(env['FUNNY_ARG'], funky_str) + reap_children() if __name__ == '__main__': |