lint and improve tests

This commit is contained in:
Victor Shyba 2020-03-11 17:59:56 -03:00
parent 8169bf6b97
commit ec541e2057
2 changed files with 8 additions and 8 deletions

View file

@ -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.

View file

@ -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