Use logging in individual tests

This commit is contained in:
John Newbery
2017-03-07 18:46:17 -05:00
parent 38ad281b2a
commit 64c080051b
33 changed files with 212 additions and 224 deletions

View File

@@ -34,8 +34,6 @@ and confirm again balances are correct.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from random import randint
import logging
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO, stream=sys.stdout)
class WalletBackupTest(BitcoinTestFramework):
@@ -100,7 +98,7 @@ class WalletBackupTest(BitcoinTestFramework):
os.remove(self.options.tmpdir + "/node2/regtest/wallet.dat")
def run_test(self):
logging.info("Generating initial blockchain")
self.log.info("Generating initial blockchain")
self.nodes[0].generate(1)
sync_blocks(self.nodes)
self.nodes[1].generate(1)
@@ -115,12 +113,12 @@ class WalletBackupTest(BitcoinTestFramework):
assert_equal(self.nodes[2].getbalance(), 50)
assert_equal(self.nodes[3].getbalance(), 0)
logging.info("Creating transactions")
self.log.info("Creating transactions")
# Five rounds of sending each other transactions.
for i in range(5):
self.do_one_round()
logging.info("Backing up")
self.log.info("Backing up")
tmpdir = self.options.tmpdir
self.nodes[0].backupwallet(tmpdir + "/node0/wallet.bak")
self.nodes[0].dumpwallet(tmpdir + "/node0/wallet.dump")
@@ -129,7 +127,7 @@ class WalletBackupTest(BitcoinTestFramework):
self.nodes[2].backupwallet(tmpdir + "/node2/wallet.bak")
self.nodes[2].dumpwallet(tmpdir + "/node2/wallet.dump")
logging.info("More transactions")
self.log.info("More transactions")
for i in range(5):
self.do_one_round()
@@ -150,7 +148,7 @@ class WalletBackupTest(BitcoinTestFramework):
##
# Test restoring spender wallets from backups
##
logging.info("Restoring using wallet.dat")
self.log.info("Restoring using wallet.dat")
self.stop_three()
self.erase_three()
@@ -163,7 +161,7 @@ class WalletBackupTest(BitcoinTestFramework):
shutil.copyfile(tmpdir + "/node1/wallet.bak", tmpdir + "/node1/regtest/wallet.dat")
shutil.copyfile(tmpdir + "/node2/wallet.bak", tmpdir + "/node2/regtest/wallet.dat")
logging.info("Re-starting nodes")
self.log.info("Re-starting nodes")
self.start_three()
sync_blocks(self.nodes)
@@ -171,7 +169,7 @@ class WalletBackupTest(BitcoinTestFramework):
assert_equal(self.nodes[1].getbalance(), balance1)
assert_equal(self.nodes[2].getbalance(), balance2)
logging.info("Restoring using dumped wallet")
self.log.info("Restoring using dumped wallet")
self.stop_three()
self.erase_three()