Browse Source

pytest: Pretty print the memleak output in tests

It wasn't JSON formatted either so there was no nice pretty-printing
way. This jsonifies and pretty prints it.

Signed-off-by: Christian Decker <@cdecker>
plugin-3
Christian Decker 6 years ago
committed by Rusty Russell
parent
commit
522c3039ec
  1. 19
      tests/utils.py

19
tests/utils.py

@ -1,3 +1,10 @@
from bitcoin.rpc import RawProxy as BitcoinProxy
from btcproxy import BitcoinRpcProxy
from decimal import Decimal
from ephemeral_port_reserve import reserve
from lightning import LightningRpc
import json
import logging
import os
import random
@ -9,12 +16,6 @@ import subprocess
import threading
import time
from btcproxy import BitcoinRpcProxy
from bitcoin.rpc import RawProxy as BitcoinProxy
from decimal import Decimal
from ephemeral_port_reserve import reserve
from lightning import LightningRpc
BITCOIND_CONFIG = {
"regtest": 1,
"rpcuser": "rpcuser",
@ -864,7 +865,9 @@ class NodeFactory(object):
unexpected_fail = True
if leaks is not None and len(leaks) != 0:
raise Exception("Node {} has memory leaks: {}"
.format(self.nodes[i].daemon.lightning_dir, leaks))
raise Exception("Node {} has memory leaks: {}".format(
self.nodes[i].daemon.lightning_dir,
json.dumps(leaks, sort_keys=True, indent=4)
))
return not unexpected_fail

Loading…
Cancel
Save