mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-30 15:58:24 +01:00
Explicitly specify encoding when opening text files in Python code
This commit is contained in:
@@ -36,7 +36,7 @@ class NotificationsTest(BitcoinTestFramework):
|
||||
wait_until(lambda: os.path.isfile(self.block_filename) and os.stat(self.block_filename).st_size >= (block_count * 65), timeout=10)
|
||||
|
||||
# file content should equal the generated blocks hashes
|
||||
with open(self.block_filename, 'r') as f:
|
||||
with open(self.block_filename, 'r', encoding="utf-8") as f:
|
||||
assert_equal(sorted(blocks), sorted(l.strip() for l in f.read().splitlines()))
|
||||
|
||||
self.log.info("test -walletnotify")
|
||||
@@ -45,7 +45,7 @@ class NotificationsTest(BitcoinTestFramework):
|
||||
|
||||
# file content should equal the generated transaction hashes
|
||||
txids_rpc = list(map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count)))
|
||||
with open(self.tx_filename, 'r') as f:
|
||||
with open(self.tx_filename, 'r', encoding="ascii") as f:
|
||||
assert_equal(sorted(txids_rpc), sorted(l.strip() for l in f.read().splitlines()))
|
||||
os.remove(self.tx_filename)
|
||||
|
||||
@@ -58,7 +58,7 @@ class NotificationsTest(BitcoinTestFramework):
|
||||
|
||||
# file content should equal the generated transaction hashes
|
||||
txids_rpc = list(map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count)))
|
||||
with open(self.tx_filename, 'r') as f:
|
||||
with open(self.tx_filename, 'r', encoding="ascii") as f:
|
||||
assert_equal(sorted(txids_rpc), sorted(l.strip() for l in f.read().splitlines()))
|
||||
|
||||
# Mine another 41 up-version blocks. -alertnotify should trigger on the 51st.
|
||||
|
||||
Reference in New Issue
Block a user