aboutsummaryrefslogtreecommitdiff
path: root/src/test/bitcoin-util-test.py
diff options
context:
space:
mode:
authorjnewbery <john@johnnewbery.com>2016-10-24 12:49:25 +0100
committerjnewbery <john@johnnewbery.com>2016-11-02 18:16:57 +0000
commit32c0d6e1d2b360501370efef40468ca28cc2cd89 (patch)
tree42532dc1e93d85ecf97724d30bb6e104cf11c2ed /src/test/bitcoin-util-test.py
parenta4fd8dff68369de497354574624b740f42175b1b (diff)
Add logging to bitcoin-util-test.py
- Use the python standard logging library - Run all tests and report all failing test-cases (rather than stop after one test case fails) - If output is different from expected output, log a contextual diff.
Diffstat (limited to 'src/test/bitcoin-util-test.py')
-rwxr-xr-xsrc/test/bitcoin-util-test.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/test/bitcoin-util-test.py b/src/test/bitcoin-util-test.py
index 3099506d6d..9afe91aca0 100755
--- a/src/test/bitcoin-util-test.py
+++ b/src/test/bitcoin-util-test.py
@@ -4,9 +4,11 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from __future__ import division,print_function,unicode_literals
import os
+import sys
import bctest
import buildenv
import argparse
+import logging
help_text="""Test framework for bitcoin utils.
@@ -19,9 +21,9 @@ test/bitcoin-util-test.py --src=[srcdir]
if __name__ == '__main__':
- verbose = False
try:
srcdir = os.environ["srcdir"]
+ verbose = False
except:
parser = argparse.ArgumentParser(description=help_text)
parser.add_argument('-s', '--srcdir')
@@ -29,4 +31,13 @@ if __name__ == '__main__':
args = parser.parse_args()
srcdir = args.srcdir
verbose = args.verbose
- bctest.bctester(srcdir + "/test/data", "bitcoin-util-test.json", buildenv, verbose = verbose)
+
+ if verbose:
+ level = logging.DEBUG
+ else:
+ level = logging.ERROR
+ formatter = '%(asctime)s - %(levelname)s - %(message)s'
+ # Add the format/level to the logger
+ logging.basicConfig(format = formatter, level=level)
+
+ bctest.bctester(srcdir + "/test/data", "bitcoin-util-test.json", buildenv)