mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-28 07:48:36 +02:00
Merge #19504: Bump minimum python version to 3.6
97c738ff1b[tests] Recommend f-strings for formatting, update feature_block to use them (Anthony Towns)8ae9d314e9Bump minimum python version to 3.6 (Anthony Towns) Pull request description: Python 3.5 has reached [end-of-life](https://devguide.python.org/#status-of-python-branches) as of September 2020, and 3.6 has some moderately nice [features](https://docs.python.org/3/whatsnew/3.6.html): - `f'x = {x}'` as an alternative to `'x = {}'.format(x)` format strings (cf https://github.com/bitcoin/bitcoin/pull/13718#issuecomment-406591027) - underscore separators for large numbers, like `1_234_567` - improvements to async - improvements to typing module Note that 3.6 is not available in xenial (16.04), but is available in bionic (18.04), while focal (20.04) has 3.8. CentOS 7 and 8 have 3.6.8, Debian stable has 3.7.3, and [gentoo and arch already had 3.6 and 3.7 in 2018](https://github.com/bitcoin/bitcoin/pull/14954#issuecomment-447118707). ACKs for top commit: MarcoFalke: re-ACK97c738ff1bTree-SHA512: ec7fce68845edde4d61a42de12c065fd49e5217311a6fda1323206f091a0afd50f293645dffc27d420127e4e5deb864e953f1b67eff735a0dfbbedd7899a9d60
This commit is contained in:
@@ -34,7 +34,7 @@ don't have test cases for.
|
||||
- When subclassing the BitcoinTestFramework, place overrides for the
|
||||
`set_test_params()`, `add_options()` and `setup_xxxx()` methods at the top of
|
||||
the subclass, then locally-defined helper methods, then the `run_test()` method.
|
||||
- Use `'{}'.format(x)` for string formatting, not `'%s' % x`.
|
||||
- Use `f'{x}'` for string formatting in preference to `'{}'.format(x)` or `'%s' % x`.
|
||||
|
||||
#### Naming guidelines
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class FullBlockTest(BitcoinTestFramework):
|
||||
# Allow the block to mature
|
||||
blocks = []
|
||||
for i in range(NUM_BUFFER_BLOCKS_TO_GENERATE):
|
||||
blocks.append(self.next_block("maturitybuffer.{}".format(i)))
|
||||
blocks.append(self.next_block(f"maturitybuffer.{i}"))
|
||||
self.save_spendable_output()
|
||||
self.send_blocks(blocks)
|
||||
|
||||
@@ -151,8 +151,8 @@ class FullBlockTest(BitcoinTestFramework):
|
||||
if template.valid_in_block:
|
||||
continue
|
||||
|
||||
self.log.info("Reject block with invalid tx: %s", TxTemplate.__name__)
|
||||
blockname = "for_invalid.%s" % TxTemplate.__name__
|
||||
self.log.info(f"Reject block with invalid tx: {TxTemplate.__name__}")
|
||||
blockname = f"for_invalid.{TxTemplate.__name__}"
|
||||
badblock = self.next_block(blockname)
|
||||
badtx = template.get_tx()
|
||||
if TxTemplate != invalid_txs.InputMissing:
|
||||
@@ -1355,12 +1355,12 @@ class FullBlockTest(BitcoinTestFramework):
|
||||
|
||||
# save the current tip so it can be spent by a later block
|
||||
def save_spendable_output(self):
|
||||
self.log.debug("saving spendable output %s" % self.tip.vtx[0])
|
||||
self.log.debug(f"saving spendable output {self.tip.vtx[0]}")
|
||||
self.spendable_outputs.append(self.tip)
|
||||
|
||||
# get an output that we previously marked as spendable
|
||||
def get_spendable_output(self):
|
||||
self.log.debug("getting spendable output %s" % self.spendable_outputs[0].vtx[0])
|
||||
self.log.debug(f"getting spendable output {self.spendable_outputs[0].vtx[0]}")
|
||||
return self.spendable_outputs.pop(0).vtx[0]
|
||||
|
||||
# move the tip back to a previous block
|
||||
|
||||
Reference in New Issue
Block a user