MCPcopy Create free account
hub / github.com/ElementsProject/elements / main

Function main

test/functional/test_runner.py:390–521  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

388]
389
390def main():
391 # Parse arguments and pass through unrecognised args
392 parser = argparse.ArgumentParser(add_help=False,
393 usage='%(prog)s [test_runner.py options] [script options] [scripts]',
394 description=__doc__,
395 epilog='''
396 Help text and arguments for individual test script:''',
397 formatter_class=argparse.RawTextHelpFormatter)
398 parser.add_argument('--ansi', action='store_true', default=sys.stdout.isatty(), help="Use ANSI colors and dots in output (enabled by default when standard output is a TTY)")
399 parser.add_argument('--combinedlogslen', '-c', type=int, default=0, metavar='n', help='On failure, print a log (of length n lines) to the console, combined from the test framework and all test nodes.')
400 parser.add_argument('--coverage', action='store_true', help='generate a basic coverage report for the RPC interface')
401 parser.add_argument('--ci', action='store_true', help='Run checks and code that are usually only enabled in a continuous integration environment')
402 parser.add_argument('--exclude', '-x', help='specify a comma-separated-list of scripts to exclude.')
403 parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests')
404 parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')
405 parser.add_argument('--jobs', '-j', type=int, default=4, help='how many test scripts to run in parallel. Default=4.')
406 parser.add_argument('--keepcache', '-k', action='store_true', help='the default behavior is to flush the cache directory on startup. --keepcache retains the cache from the previous testrun.')
407 parser.add_argument('--quiet', '-q', action='store_true', help='only print dots, results summary and failure logs')
408 parser.add_argument('--tmpdirprefix', '-t', default=tempfile.gettempdir(), help="Root directory for datadirs")
409 parser.add_argument('--failfast', '-F', action='store_true', help='stop execution after the first test failure')
410 parser.add_argument('--filter', help='filter scripts to run by regular expression')
411
412 args, unknown_args = parser.parse_known_args()
413 if not args.ansi:
414 global BOLD, GREEN, RED, GREY
415 BOLD = ("", "")
416 GREEN = ("", "")
417 RED = ("", "")
418 GREY = ("", "")
419
420 # args to be passed on always start with two dashes; tests are the remaining unknown args
421 tests = [arg for arg in unknown_args if arg[:2] != "--"]
422 passon_args = [arg for arg in unknown_args if arg[:2] == "--"]
423
424 # Read config generated by configure.
425 config = configparser.ConfigParser()
426 configfile = os.path.abspath(os.path.dirname(__file__)) + "/../config.ini"
427 config.read_file(open(configfile, encoding="utf8"))
428
429 passon_args.append("--configfile=%s" % configfile)
430
431 # Set up logging
432 logging_level = logging.INFO if args.quiet else logging.DEBUG
433 logging.basicConfig(format='%(message)s', level=logging_level)
434
435 # Create base test directory
436 tmpdir = "%s/test_runner_₿_🏃_%s" % (args.tmpdirprefix, datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
437
438 os.makedirs(tmpdir)
439
440 logging.debug("Temporary test directory at %s" % tmpdir)
441
442 enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND")
443
444 if not enable_bitcoind:
445 print("No functional tests to run.")
446 print("Rerun ./configure with --with-daemon and then make")
447 sys.exit(0)

Callers 1

test_runner.pyFile · 0.70

Calls 7

nowMethod · 0.80
formatMethod · 0.80
check_script_listFunction · 0.70
check_script_prefixesFunction · 0.70
run_testsFunction · 0.70
removeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected