Merge #12806: qa: Fix function names in feature_blocksdir

d71bedb qa: Fix function names in feature_blocksdir (MarcoFalke)

Pull request description:

  This fixes the test failure on master:

  ```
  AttributeError: 'BlocksdirTest' object has no attribute 'assert_start_raises_init_error'
  ```

Tree-SHA512: d96a9b707a9b4fb8752b15f28dae02c60c25cbec21dca5f3ee62e2717c6a49951533c24b52ed0d6e99c5a964ef2c3e90fdc58a9104122714ae9874e121955df6
This commit is contained in:
Wladimir J. van der Laan 2018-03-28 11:05:37 +02:00
commit 18606eb475
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D

View File

@ -5,10 +5,12 @@
"""Test the blocksdir option. """Test the blocksdir option.
""" """
import os
import re
import shutil
from test_framework.test_framework import BitcoinTestFramework, initialize_datadir from test_framework.test_framework import BitcoinTestFramework, initialize_datadir
import shutil
import os
class BlocksdirTest(BitcoinTestFramework): class BlocksdirTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
@ -17,18 +19,19 @@ class BlocksdirTest(BitcoinTestFramework):
def run_test(self): def run_test(self):
self.stop_node(0) self.stop_node(0)
node0path = os.path.join(self.options.tmpdir, "node0") shutil.rmtree(self.nodes[0].datadir)
shutil.rmtree(node0path)
initialize_datadir(self.options.tmpdir, 0) initialize_datadir(self.options.tmpdir, 0)
self.log.info("Starting with non exiting blocksdir ...") self.log.info("Starting with non exiting blocksdir ...")
self.assert_start_raises_init_error(0, ["-blocksdir="+self.options.tmpdir+ "/blocksdir"], "Specified blocks director") blocksdir_path = os.path.join(self.options.tmpdir, 'blocksdir')
os.mkdir(self.options.tmpdir+ "/blocksdir") self.nodes[0].assert_start_raises_init_error(["-blocksdir=" + blocksdir_path], re.escape('Error: Specified blocks directory "{}" does not exist.'.format(blocksdir_path)))
os.mkdir(blocksdir_path)
self.log.info("Starting with exiting blocksdir ...") self.log.info("Starting with exiting blocksdir ...")
self.start_node(0, ["-blocksdir="+self.options.tmpdir+ "/blocksdir"]) self.start_node(0, ["-blocksdir=" + blocksdir_path])
self.log.info("mining blocks..") self.log.info("mining blocks..")
self.nodes[0].generate(10) self.nodes[0].generate(10)
assert(os.path.isfile(os.path.join(self.options.tmpdir, "blocksdir", "regtest", "blocks", "blk00000.dat"))) assert os.path.isfile(os.path.join(blocksdir_path, "regtest", "blocks", "blk00000.dat"))
assert(os.path.isdir(os.path.join(self.options.tmpdir, "node0", "regtest", "blocks", "index"))) assert os.path.isdir(os.path.join(self.nodes[0].datadir, "regtest", "blocks", "index"))
if __name__ == '__main__': if __name__ == '__main__':
BlocksdirTest().main() BlocksdirTest().main()