Skip to content

Commit

Permalink
[tests] Make comp test framework more debuggable
Browse files Browse the repository at this point in the history
Add logging so that each test prints the line number of the yield
statement that generated the test.
  • Loading branch information
John Newbery committed Oct 9, 2017
1 parent 17f2ace commit 7481579
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/functional/test_framework/comptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,11 @@ def run(self):
# Wait until verack is received
self.wait_for_verack()

test_number = 1
for test_instance in self.test_generator.get_tests():
test_number = 0
tests = self.test_generator.get_tests()
for test_instance in tests:
test_number += 1
logger.info("Running test %d: %s line %s" % (test_number, tests.gi_code.co_filename, tests.gi_frame.f_lineno))
# We use these variables to keep track of the last block
# and last transaction in the tests, which are used
# if we're not syncing on every block or every tx.
Expand Down Expand Up @@ -397,9 +400,6 @@ def run(self):
if (not self.check_mempool(tx.sha256, tx_outcome)):
raise AssertionError("Mempool test failed at test %d" % test_number)

logger.info("Test %d: PASS" % test_number)
test_number += 1

[ c.disconnect_node() for c in self.connections ]
self.wait_for_disconnections()
self.block_store.close()
Expand Down

0 comments on commit 7481579

Please sign in to comment.