Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_framework.py
Show First 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | def shutdown(self): | ||||
self.log.info("Test skipped") | self.log.info("Test skipped") | ||||
exit_code = TEST_EXIT_SKIPPED | exit_code = TEST_EXIT_SKIPPED | ||||
else: | else: | ||||
self.log.error( | self.log.error( | ||||
"Test failed. Test logging available at {}/test_framework.log".format(self.options.tmpdir)) | "Test failed. Test logging available at {}/test_framework.log".format(self.options.tmpdir)) | ||||
self.log.error("Hint: Call {} '{}' to consolidate all logs".format(os.path.normpath( | self.log.error("Hint: Call {} '{}' to consolidate all logs".format(os.path.normpath( | ||||
os.path.dirname(os.path.realpath(__file__)) + "/../combine_logs.py"), self.options.tmpdir)) | os.path.dirname(os.path.realpath(__file__)) + "/../combine_logs.py"), self.options.tmpdir)) | ||||
exit_code = TEST_EXIT_FAILED | exit_code = TEST_EXIT_FAILED | ||||
logging.shutdown() | # Logging.shutdown will not remove stream- and filehandlers, so we must | ||||
# do it explicitly. Handlers are removed so the next test run can apply | |||||
# different log handler settings. | |||||
# See: https://docs.python.org/3/library/logging.html#logging.shutdown | |||||
for h in list(self.log.handlers): | |||||
h.flush() | |||||
h.close() | |||||
self.log.removeHandler(h) | |||||
rpc_logger = logging.getLogger("BitcoinRPC") | |||||
for h in list(rpc_logger.handlers): | |||||
h.flush() | |||||
rpc_logger.removeHandler(h) | |||||
if cleanup_tree_on_exit: | if cleanup_tree_on_exit: | ||||
shutil.rmtree(self.options.tmpdir) | shutil.rmtree(self.options.tmpdir) | ||||
return exit_code | return exit_code | ||||
# Methods to override in subclass test scripts. | # Methods to override in subclass test scripts. | ||||
def set_test_params(self): | def set_test_params(self): | ||||
"""Tests must this method to change default values for number of nodes, topology, etc""" | """Tests must this method to change default values for number of nodes, topology, etc""" | ||||
raise NotImplementedError | raise NotImplementedError | ||||
▲ Show 20 Lines • Show All 377 Lines • Show Last 20 Lines |