Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_runner.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
Lint: Code style violation: '/Users/shammah/repos/bitcoin-abc/test/functional/test_runner.py' has code style errors. | |||||
# Copyright (c) 2014-2016 The Bitcoin Core developers | # Copyright (c) 2014-2016 The Bitcoin Core developers | ||||
# Copyright (c) 2017 The Bitcoin developers | # Copyright (c) 2017 The Bitcoin developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Run regression test suite. | """Run regression test suite. | ||||
This module calls down into individual test cases via subprocess. It will | This module calls down into individual test cases via subprocess. It will | ||||
forward all unrecognized arguments onto the individual test scripts. | forward all unrecognized arguments onto the individual test scripts. | ||||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | |||||
def main(): | def main(): | ||||
# Read config generated by configure. | # Read config generated by configure. | ||||
config = configparser.ConfigParser() | config = configparser.ConfigParser() | ||||
configfile = os.path.join(os.path.abspath( | configfile = os.path.join(os.path.abspath( | ||||
os.path.dirname(__file__)), "..", "config.ini") | os.path.dirname(__file__)), "..", "config.ini") | ||||
config.read_file(open(configfile)) | config.read_file(open(configfile)) | ||||
src_dir = config["environment"]["SRCDIR"] | src_dir = config["environment"]["SRCDIR"] | ||||
if 'SRCDIR' in os.environ: | |||||
jasonbcoxUnsubmitted Not Done Inline ActionsIf src_dir already has a value from above, I think this check should fail with an error saying src_dir is defined twice jasonbcox: If src_dir already has a value from above, I think this check should fail with an error saying… | |||||
schancelAuthorUnsubmitted Done Inline Actionssrc_dir will always be defined by the config setup by ./configure schancel: `src_dir` will always be defined by the config setup by `./configure` | |||||
deadalnixUnsubmitted Not Done Inline ActionsDo we have a reason to think that ./configure may sometime be wrong ? deadalnix: Do we have a reason to think that ./configure may sometime be wrong ? | |||||
schancelAuthorUnsubmitted Done Inline ActionsI don't, but this is fixing incongruent behavior between get_srcdir() and the main script here. As for the environment variable, depending on how the tests are ran, get_scrdir() make not be able to find the srcdir. It's not particularly nice, but setting the environment variable is a fix. schancel: I don't, but this is fixing incongruent behavior between `get_srcdir()` and the main script… | |||||
src_dir = os.environ['SRCDIR'] | |||||
else: | |||||
# Setup SRCDIR env since subprocesses can't find it properly without the env. | |||||
os.environ['SRCDIR'] = src_dir | |||||
build_dir = config["environment"]["BUILDDIR"] | build_dir = config["environment"]["BUILDDIR"] | ||||
tests_dir = os.path.join(src_dir, 'test', 'functional') | tests_dir = os.path.join(src_dir, 'test', 'functional') | ||||
# Parse arguments and pass through unrecognised args | # Parse arguments and pass through unrecognised args | ||||
parser = argparse.ArgumentParser(add_help=False, | parser = argparse.ArgumentParser(add_help=False, | ||||
usage='%(prog)s [test_runner.py options] [script options] [scripts]', | usage='%(prog)s [test_runner.py options] [script options] [scripts]', | ||||
description=__doc__, | description=__doc__, | ||||
epilog=''' | epilog=''' | ||||
▲ Show 20 Lines • Show All 555 Lines • Show Last 20 Lines |
'/Users/shammah/repos/bitcoin-abc/test/functional/test_runner.py' has code style errors.