test: use f-strings in feature_blocksdir.py

This commit is contained in:
fanquake 2021-06-11 13:42:56 +08:00
parent 5453e87062
commit dca173cc04
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -24,10 +24,10 @@ class BlocksdirTest(BitcoinTestFramework):
initialize_datadir(self.options.tmpdir, 0, self.chain) initialize_datadir(self.options.tmpdir, 0, self.chain)
self.log.info("Starting with nonexistent blocksdir ...") self.log.info("Starting with nonexistent blocksdir ...")
blocksdir_path = os.path.join(self.options.tmpdir, 'blocksdir') blocksdir_path = os.path.join(self.options.tmpdir, 'blocksdir')
self.nodes[0].assert_start_raises_init_error(["-blocksdir=" + blocksdir_path], 'Error: Specified blocks directory "{}" does not exist.'.format(blocksdir_path)) self.nodes[0].assert_start_raises_init_error([f"-blocksdir={blocksdir_path}"], f'Error: Specified blocks directory "{blocksdir_path}" does not exist.')
os.mkdir(blocksdir_path) os.mkdir(blocksdir_path)
self.log.info("Starting with existing blocksdir ...") self.log.info("Starting with existing blocksdir ...")
self.start_node(0, ["-blocksdir=" + blocksdir_path]) self.start_node(0, [f"-blocksdir={blocksdir_path}"])
self.log.info("mining blocks..") self.log.info("mining blocks..")
self.nodes[0].generatetoaddress(10, self.nodes[0].get_deterministic_priv_key().address) self.nodes[0].generatetoaddress(10, self.nodes[0].get_deterministic_priv_key().address)
assert os.path.isfile(os.path.join(blocksdir_path, self.chain, "blocks", "blk00000.dat")) assert os.path.isfile(os.path.join(blocksdir_path, self.chain, "blocks", "blk00000.dat"))