Skip to content

Commit cf8073f

Browse files
author
MarcoFalke
committed
Merge #12917: qa: Windows fixups for functional tests
fab9095 qa: Windows fixups for functional tests (MarcoFalke) Pull request description: Just two minor fixups to have less errors when the tests run on native windows. * Strip whitespace from lines when reading from a notification file * Instead of clumsily creating a file with weird permissions, just create a folder for the same effect in `mempool_persist.py` Tree-SHA512: 48a8b439f14ab9b44c5cd228cd03105e8613e703e3c2951cdf724931bc95172a9ad9bfe69fc23e73dd91b058c1352263c0ac6e8de2ceb0ebf804c8ff52bba394
2 parents 0700b6f + fab9095 commit cf8073f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

test/functional/feature_notifications.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def run_test(self):
3737

3838
# file content should equal the generated blocks hashes
3939
with open(self.block_filename, 'r') as f:
40-
assert_equal(sorted(blocks), sorted(f.read().splitlines()))
40+
assert_equal(sorted(blocks), sorted(l.strip() for l in f.read().splitlines()))
4141

4242
self.log.info("test -walletnotify")
4343
# wait at most 10 seconds for expected file size before reading the content
@@ -46,7 +46,7 @@ def run_test(self):
4646
# file content should equal the generated transaction hashes
4747
txids_rpc = list(map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count)))
4848
with open(self.tx_filename, 'r') as f:
49-
assert_equal(sorted(txids_rpc), sorted(f.read().splitlines()))
49+
assert_equal(sorted(txids_rpc), sorted(l.strip() for l in f.read().splitlines()))
5050
os.remove(self.tx_filename)
5151

5252
self.log.info("test -walletnotify after rescan")
@@ -59,7 +59,7 @@ def run_test(self):
5959
# file content should equal the generated transaction hashes
6060
txids_rpc = list(map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count)))
6161
with open(self.tx_filename, 'r') as f:
62-
assert_equal(sorted(txids_rpc), sorted(f.read().splitlines()))
62+
assert_equal(sorted(txids_rpc), sorted(l.strip() for l in f.read().splitlines()))
6363

6464
# Mine another 41 up-version blocks. -alertnotify should trigger on the 51st.
6565
self.log.info("test -alertnotify")

test/functional/mempool_persist.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ def run_test(self):
107107
wait_until(lambda: len(self.nodes[1].getrawmempool()) == 5)
108108

109109
self.log.debug("Prevent bitcoind from writing mempool.dat to disk. Verify that `savemempool` fails")
110-
# to test the exception we are setting bad permissions on a tmp file called mempool.dat.new
110+
# to test the exception we are creating a tmp folder called mempool.dat.new
111111
# which is an implementation detail that could change and break this test
112112
mempooldotnew1 = mempooldat1 + '.new'
113-
with os.fdopen(os.open(mempooldotnew1, os.O_CREAT, 0o000), 'w'):
114-
pass
113+
os.mkdir(mempooldotnew1)
115114
assert_raises_rpc_error(-1, "Unable to dump mempool to disk", self.nodes[1].savemempool)
116-
os.remove(mempooldotnew1)
115+
os.rmdir(mempooldotnew1)
116+
117117

118118
if __name__ == '__main__':
119119
MempoolPersistTest().main()

0 commit comments

Comments
 (0)