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. 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 Enable/disable tracemalloc memory tracing
@ -4556,7 +4556,7 @@ class Daemon(metaclass=JSONRPCServerType):
tracemalloc.stop() tracemalloc.stop()
return tracemalloc.is_tracing() 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. Show most common objects, the place that created them and their size.

View file

@ -48,9 +48,9 @@ class TroubleshootingCommands(CommandTestCase):
class WeirdObject(): class WeirdObject():
pass pass
hold_em = [WeirdObject() for _ in range(500)] hold_em = [WeirdObject() for _ in range(500)]
self.assertEqual( top = self.daemon.jsonrpc_tracemalloc_top(1)
[{'code': 'hold_em = [WeirdObject() for _ in range(500)]', self.assertEqual(1, len(top))
'count': 502, self.assertEqual('hold_em = [WeirdObject() for _ in range(500)]', top[0]['code'])
'line': 'other/test_other_commands.py:50', self.assertTrue(top[0]['line'].startswith('other/test_other_commands.py:'))
'size': 36656}], self.daemon.jsonrpc_tracemalloc_top(items=1) self.assertGreaterEqual(top[0]['count'], 500)
) self.assertGreater(top[0]['size'], 0) # just matters that its a positive integer