From 5c51581f1ea80b3d3ab5652ac0d904f8cb65fd77 Mon Sep 17 00:00:00 2001 From: Adrian Page Date: Sat, 28 Oct 2017 18:40:29 +0100 Subject: 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: [ E E + [] E - [, E - , E - , E - , E - , E - , E - , E - , E - , E - ] --- psutil/tests/test_connections.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'psutil/tests/test_connections.py') 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() -- cgit v1.2.1 From 500b80bcf7deb77ceeaa9165fa538e0f7ad134c8 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Sat, 11 Nov 2017 22:04:40 +0100 Subject: disable IPv6 tests if IPv6 is not supported --- psutil/tests/test_connections.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'psutil/tests/test_connections.py') diff --git a/psutil/tests/test_connections.py b/psutil/tests/test_connections.py index d248af57..176e2664 100755 --- a/psutil/tests/test_connections.py +++ b/psutil/tests/test_connections.py @@ -152,6 +152,7 @@ class TestUnconnectedSockets(Base, unittest.TestCase): assert not conn.raddr self.assertEqual(conn.status, psutil.CONN_LISTEN) + @unittest.skipIf(not supports_ipv6(), "IPv6 not supported") def test_tcp_v6(self): addr = ("::1", get_free_port()) with closing(bind_socket(AF_INET6, SOCK_STREAM, addr=addr)) as sock: @@ -166,6 +167,7 @@ class TestUnconnectedSockets(Base, unittest.TestCase): assert not conn.raddr self.assertEqual(conn.status, psutil.CONN_NONE) + @unittest.skipIf(not supports_ipv6(), "IPv6 not supported") def test_udp_v6(self): addr = ("::1", get_free_port()) with closing(bind_socket(AF_INET6, SOCK_DGRAM, addr=addr)) as sock: -- cgit v1.2.1