Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_framework.py
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | def main(self): | ||||
self.options.srcdir + os.path.sep + "qt" + os.pathsep + \ | self.options.srcdir + os.path.sep + "qt" + os.pathsep + \ | ||||
os.environ['PATH'] | os.environ['PATH'] | ||||
check_json_precision() | check_json_precision() | ||||
self.options.cachedir = os.path.abspath(self.options.cachedir) | self.options.cachedir = os.path.abspath(self.options.cachedir) | ||||
config = configparser.ConfigParser() | config = configparser.ConfigParser() | ||||
config.read_file(open(self.options.configfile)) | config.read_file(open(self.options.configfile, encoding='utf-8')) | ||||
self.options.bitcoind = os.getenv( | self.options.bitcoind = os.getenv( | ||||
"BITCOIND", default=config["environment"]["BUILDDIR"] + '/src/bitcoind' + config["environment"]["EXEEXT"]) | "BITCOIND", default=config["environment"]["BUILDDIR"] + '/src/bitcoind' + config["environment"]["EXEEXT"]) | ||||
self.options.bitcoincli = os.getenv( | self.options.bitcoincli = os.getenv( | ||||
"BITCOINCLI", default=config["environment"]["BUILDDIR"] + '/src/bitcoin-cli' + config["environment"]["EXEEXT"]) | "BITCOINCLI", default=config["environment"]["BUILDDIR"] + '/src/bitcoin-cli' + config["environment"]["EXEEXT"]) | ||||
# Set up temp directory and start logging | # Set up temp directory and start logging | ||||
if self.options.tmpdir: | if self.options.tmpdir: | ||||
self.options.tmpdir = os.path.abspath(self.options.tmpdir) | self.options.tmpdir = os.path.abspath(self.options.tmpdir) | ||||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | class BitcoinTestFramework(): | ||||
# Private helper methods. These should not be accessed by the subclass test scripts. | # Private helper methods. These should not be accessed by the subclass test scripts. | ||||
def _start_logging(self): | def _start_logging(self): | ||||
# Add logger and logging handlers | # Add logger and logging handlers | ||||
self.log = logging.getLogger('TestFramework') | self.log = logging.getLogger('TestFramework') | ||||
self.log.setLevel(logging.DEBUG) | self.log.setLevel(logging.DEBUG) | ||||
# Create file handler to log all messages | # Create file handler to log all messages | ||||
fh = logging.FileHandler(self.options.tmpdir + '/test_framework.log') | fh = logging.FileHandler( | ||||
self.options.tmpdir + '/test_framework.log', encoding='utf-8') | |||||
fh.setLevel(logging.DEBUG) | fh.setLevel(logging.DEBUG) | ||||
# Create console handler to log messages to stderr. By default this | # Create console handler to log messages to stderr. By default this | ||||
# logs only error messages, but can be configured with --loglevel. | # logs only error messages, but can be configured with --loglevel. | ||||
ch = logging.StreamHandler(sys.stdout) | ch = logging.StreamHandler(sys.stdout) | ||||
# User can provide log level as a number or string (eg DEBUG). loglevel | # User can provide log level as a number or string (eg DEBUG). loglevel | ||||
# was caught as a string, so try to convert it to an int | # was caught as a string, so try to convert it to an int | ||||
ll = int(self.options.loglevel) if self.options.loglevel.isdigit( | ll = int(self.options.loglevel) if self.options.loglevel.isdigit( | ||||
) else self.options.loglevel.upper() | ) else self.options.loglevel.upper() | ||||
▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines |