From e3bac12683f1be197efd5bed37787dbb81f8d100 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 3 May 2018 17:00:46 +0200 Subject: [PATCH] pytest: Allow stdout to be dropped for bitcoind We never really look at the output, and it's rather noisy, so we just stop writing to the log. Signed-off-by: Christian Decker --- tests/utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/utils.py b/tests/utils.py index a6090151f..155787233 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -50,7 +50,7 @@ class TailableProc(object): tail the processes and react to their output. """ - def __init__(self, outputDir=None): + def __init__(self, outputDir=None, verbose=True): self.logs = [] self.logs_cond = threading.Condition(threading.RLock()) self.env = os.environ @@ -59,6 +59,9 @@ class TailableProc(object): self.outputDir = outputDir self.logsearch_start = 0 + # Should we be logging lines we read from stdout? + self.verbose = verbose + def start(self): """Start the underlying process and start monitoring it. """ @@ -110,9 +113,10 @@ class TailableProc(object): for line in iter(self.proc.stdout.readline, ''): if len(line) == 0: break + if self.verbose: + logging.debug("%s: %s", self.prefix, line.decode().rstrip()) with self.logs_cond: self.logs.append(str(line.rstrip())) - logging.debug("%s: %s", self.prefix, line.decode().rstrip()) self.logs_cond.notifyAll() self.running = False self.proc.stdout.close() @@ -206,7 +210,7 @@ class SimpleBitcoinProxy: class BitcoinD(TailableProc): def __init__(self, bitcoin_dir="/tmp/bitcoind-test", rpcport=18332): - TailableProc.__init__(self, bitcoin_dir) + TailableProc.__init__(self, bitcoin_dir, verbose=False) self.bitcoin_dir = bitcoin_dir self.rpcport = rpcport