diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index 56614b98a..c63ce39ab 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -4537,7 +4537,7 @@ class Daemon(metaclass=JSONRPCServerType): Controls and queries tracemalloc memory tracing tools for troubleshooting. """ - def jsonrpc_tracemalloc_set(self, enable: bool): + def jsonrpc_tracemalloc_set(self, enable: bool): # pylint: disable=no-self-use """ Enable/disable tracemalloc memory tracing @@ -4556,7 +4556,7 @@ class Daemon(metaclass=JSONRPCServerType): tracemalloc.stop() return tracemalloc.is_tracing() - def jsonrpc_tracemalloc_top(self, items: int = 10): + def jsonrpc_tracemalloc_top(self, items: int = 10): # pylint: disable=no-self-use """ Show most common objects, the place that created them and their size. diff --git a/tests/integration/other/test_other_commands.py b/tests/integration/other/test_other_commands.py index deb9bf936..5d1c74048 100644 --- a/tests/integration/other/test_other_commands.py +++ b/tests/integration/other/test_other_commands.py @@ -48,9 +48,9 @@ class TroubleshootingCommands(CommandTestCase): class WeirdObject(): pass hold_em = [WeirdObject() for _ in range(500)] - self.assertEqual( - [{'code': 'hold_em = [WeirdObject() for _ in range(500)]', - 'count': 502, - 'line': 'other/test_other_commands.py:50', - 'size': 36656}], self.daemon.jsonrpc_tracemalloc_top(items=1) - ) + top = self.daemon.jsonrpc_tracemalloc_top(1) + self.assertEqual(1, len(top)) + self.assertEqual('hold_em = [WeirdObject() for _ in range(500)]', top[0]['code']) + self.assertTrue(top[0]['line'].startswith('other/test_other_commands.py:')) + self.assertGreaterEqual(top[0]['count'], 500) + self.assertGreater(top[0]['size'], 0) # just matters that its a positive integer