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

Function bctester

test/util/test_runner.py:43–65  ·  view source on GitHub ↗

Loads and parses the input file, runs all tests and reports results

(testDir, input_basename, buildenv)

Source from the content-addressed store, hash-verified

41 bctester(os.path.join(env_conf["SRCDIR"], "test", "util", "data"), "bitcoin-util-test.json", env_conf)
42
43def bctester(testDir, input_basename, buildenv):
44 """ Loads and parses the input file, runs all tests and reports results"""
45 input_filename = os.path.join(testDir, input_basename)
46 raw_data = open(input_filename, encoding="utf8").read()
47 input_data = json.loads(raw_data)
48
49 failed_testcases = []
50
51 for testObj in input_data:
52 try:
53 bctest(testDir, testObj, buildenv)
54 logging.info("PASSED: " + testObj["description"])
55 except:
56 logging.info("FAILED: " + testObj["description"])
57 failed_testcases.append(testObj["description"])
58
59 if failed_testcases:
60 error_message = "FAILED_TESTCASES:\n"
61 error_message += pprint.pformat(failed_testcases, width=400)
62 logging.error(error_message)
63 sys.exit(1)
64 else:
65 sys.exit(0)
66
67def bctest(testDir, testObj, buildenv):
68 """Runs a single test, comparing output and RC to expected output and RC.

Callers 1

mainFunction · 0.85

Calls 4

bctestFunction · 0.85
infoMethod · 0.80
joinMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected