aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2017-10-03 21:24:53 +0200
committerMarcoFalke <falke.marco@gmail.com>2017-10-03 21:25:00 +0200
commitb4a509a3f817121c3df98ddfd96b2769e18a3e5a (patch)
treeea4ec13c97daf8adbcd846ff5b9efed17d8233e0 /test
parentdbc4ae03963014ab4b7957d62ba59dbd8f938c33 (diff)
parentfafff1220cf798e25f02cdd8affb70506dd366cc (diff)
Merge #11433: qa: Restore bitcoin-util-test py2 compatibility
fafff1220 qa: Restore bitcoin-util-test py2 compatibility (MarcoFalke) Pull request description: Currently `./configure && make check` will look for python3, then python2. As long as we support python2 (and use it as fallback), `make check` should run fine with both python2 and python3. Fixes #11352 by @Zenitur Tree-SHA512: a335ebdd224328d6f924fe52a9b97de196926476c9ee04ce3280743ea93bcae355eb2d5d4bed4050c01b2e904105595eac7db2eaa9307207581caa0a98ebcc0b
Diffstat (limited to 'test')
-rwxr-xr-xtest/util/bitcoin-util-test.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/util/bitcoin-util-test.py b/test/util/bitcoin-util-test.py
index d15d6a6011..ef34955d90 100755
--- a/test/util/bitcoin-util-test.py
+++ b/test/util/bitcoin-util-test.py
@@ -9,9 +9,14 @@ Runs automatically during `make check`.
Can also be run manually."""
+from __future__ import division,print_function,unicode_literals
+
import argparse
import binascii
-import configparser
+try:
+ import configparser
+except ImportError:
+ import ConfigParser as configparser
import difflib
import json
import logging
@@ -22,7 +27,9 @@ import sys
def main():
config = configparser.ConfigParser()
- config.read_file(open(os.path.dirname(__file__) + "/../config.ini"))
+ config.optionxform = str
+ config.readfp(open(os.path.join(os.path.dirname(__file__), "../config.ini")))
+ env_conf = dict(config.items('environment'))
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-v', '--verbose', action='store_true')
@@ -37,7 +44,7 @@ def main():
# Add the format/level to the logger
logging.basicConfig(format=formatter, level=level)
- bctester(config["environment"]["SRCDIR"] + "/test/util/data", "bitcoin-util-test.json", config["environment"])
+ bctester(os.path.join(env_conf["SRCDIR"], "test/util/data"), "bitcoin-util-test.json", env_conf)
def bctester(testDir, input_basename, buildenv):
""" Loads and parses the input file, runs all tests and reports results"""