diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-04-09 14:37:01 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-04-09 14:37:05 -0400 |
commit | cf8073f8d1d18ab2798534bfd442445f0a1cdb6b (patch) | |
tree | ba8077adf812f8c3826d10f621b0dd1376ce2642 | |
parent | 0700b6f778d9dcef6e1e733d593cc63f195d4a3a (diff) | |
parent | fab9095d4071159f88eeefa5c1a750960fd2fbb9 (diff) |
Merge #12917: qa: Windows fixups for functional tests
fab9095d40 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
-rwxr-xr-x | test/functional/feature_notifications.py | 6 | ||||
-rwxr-xr-x | test/functional/mempool_persist.py | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/test/functional/feature_notifications.py b/test/functional/feature_notifications.py index 980bef5fc8..8964c8d64b 100755 --- a/test/functional/feature_notifications.py +++ b/test/functional/feature_notifications.py @@ -37,7 +37,7 @@ class NotificationsTest(BitcoinTestFramework): # file content should equal the generated blocks hashes with open(self.block_filename, 'r') as f: - assert_equal(sorted(blocks), sorted(f.read().splitlines())) + assert_equal(sorted(blocks), sorted(l.strip() for l in f.read().splitlines())) self.log.info("test -walletnotify") # wait at most 10 seconds for expected file size before reading the content @@ -46,7 +46,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: - assert_equal(sorted(txids_rpc), sorted(f.read().splitlines())) + assert_equal(sorted(txids_rpc), sorted(l.strip() for l in f.read().splitlines())) os.remove(self.tx_filename) self.log.info("test -walletnotify after rescan") @@ -59,7 +59,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: - assert_equal(sorted(txids_rpc), sorted(f.read().splitlines())) + 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. self.log.info("test -alertnotify") diff --git a/test/functional/mempool_persist.py b/test/functional/mempool_persist.py index 75eb9b1784..83dffb0521 100755 --- a/test/functional/mempool_persist.py +++ b/test/functional/mempool_persist.py @@ -107,13 +107,13 @@ class MempoolPersistTest(BitcoinTestFramework): wait_until(lambda: len(self.nodes[1].getrawmempool()) == 5) self.log.debug("Prevent bitcoind from writing mempool.dat to disk. Verify that `savemempool` fails") - # to test the exception we are setting bad permissions on a tmp file called mempool.dat.new + # to test the exception we are creating a tmp folder called mempool.dat.new # which is an implementation detail that could change and break this test mempooldotnew1 = mempooldat1 + '.new' - with os.fdopen(os.open(mempooldotnew1, os.O_CREAT, 0o000), 'w'): - pass + os.mkdir(mempooldotnew1) assert_raises_rpc_error(-1, "Unable to dump mempool to disk", self.nodes[1].savemempool) - os.remove(mempooldotnew1) + os.rmdir(mempooldotnew1) + if __name__ == '__main__': MempoolPersistTest().main() |