diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-09-08 10:39:06 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-09-08 18:58:31 +0200 |
commit | fadecbd9a4d47957f42672911675c400caeaac24 (patch) | |
tree | 9385c18c6b9d291f66f33eec60bbf3e89855bd03 /test | |
parent | 5e3380b9f59481fc18e05b9d651c3c733abe4053 (diff) |
test: Fix tests on Windows
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/feature_config_args.py | 26 | ||||
-rwxr-xr-x | test/functional/feature_presegwit_node_upgrade.py | 9 | ||||
-rwxr-xr-x | test/functional/rpc_signer.py | 8 | ||||
-rwxr-xr-x | test/functional/tool_wallet.py | 2 |
4 files changed, 30 insertions, 15 deletions
diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py index 0daa0ba3d8..3d9d8b7441 100755 --- a/test/functional/feature_config_args.py +++ b/test/functional/feature_config_args.py @@ -164,11 +164,14 @@ class ConfArgsTest(BitcoinTestFramework): # fixed seeds assert not os.path.exists(os.path.join(default_data_dir, "peers.dat")) start = int(time.time()) - with self.nodes[0].assert_debug_log(expected_msgs=[ - "Loaded 0 addresses from peers.dat", - "0 addresses found from DNS seeds", - "opencon thread start", # Ensure ThreadOpenConnections::start time is properly set - ]): + with self.nodes[0].assert_debug_log( + expected_msgs=[ + "Loaded 0 addresses from peers.dat", + "0 addresses found from DNS seeds", + "opencon thread start", # Ensure ThreadOpenConnections::start time is properly set + ], + timeout=10, + ): self.start_node(0, extra_args=['-dnsseed=1', '-fixedseeds=1', f'-mocktime={start}']) with self.nodes[0].assert_debug_log(expected_msgs=[ "Adding fixed seeds as 60 seconds have passed and addrman is empty", @@ -206,11 +209,14 @@ class ConfArgsTest(BitcoinTestFramework): # We expect the node will allow 60 seconds prior to using fixed seeds assert not os.path.exists(os.path.join(default_data_dir, "peers.dat")) start = int(time.time()) - with self.nodes[0].assert_debug_log(expected_msgs=[ - "Loaded 0 addresses from peers.dat", - "DNS seeding disabled", - "opencon thread start", # Ensure ThreadOpenConnections::start time is properly set - ]): + with self.nodes[0].assert_debug_log( + expected_msgs=[ + "Loaded 0 addresses from peers.dat", + "DNS seeding disabled", + "opencon thread start", # Ensure ThreadOpenConnections::start time is properly set + ], + timeout=10, + ): self.start_node(0, extra_args=['-dnsseed=0', '-fixedseeds=1', '-addnode=fakenodeaddr', f'-mocktime={start}']) with self.nodes[0].assert_debug_log(expected_msgs=[ "Adding fixed seeds as 60 seconds have passed and addrman is empty", diff --git a/test/functional/feature_presegwit_node_upgrade.py b/test/functional/feature_presegwit_node_upgrade.py index 0428588da3..eb4ee7f1b4 100755 --- a/test/functional/feature_presegwit_node_upgrade.py +++ b/test/functional/feature_presegwit_node_upgrade.py @@ -9,6 +9,8 @@ from test_framework.util import ( assert_equal, softfork_active, ) +import os + class SegwitUpgradeTest(BitcoinTestFramework): def set_test_params(self): @@ -35,8 +37,11 @@ class SegwitUpgradeTest(BitcoinTestFramework): # Restarting the node (with segwit activation height set to 5) should result in a shutdown # because the blockchain consists of 3 insufficiently validated blocks per segwit consensus rules. node.assert_start_raises_init_error( - extra_args=["-segwitheight=5"], - expected_msg=": Witness data for blocks after height 5 requires validation. Please restart with -reindex..\nPlease restart with -reindex or -reindex-chainstate to recover.") + extra_args=["-segwitheight=5"], + expected_msg=": Witness data for blocks after height 5 requires " + f"validation. Please restart with -reindex..{os.linesep}" + "Please restart with -reindex or -reindex-chainstate to recover.", + ) # As directed, the user restarts the node with -reindex self.start_node(0, extra_args=["-reindex", "-segwitheight=5"]) diff --git a/test/functional/rpc_signer.py b/test/functional/rpc_signer.py index 3188763f49..9e963eba57 100755 --- a/test/functional/rpc_signer.py +++ b/test/functional/rpc_signer.py @@ -53,8 +53,12 @@ class RPCSignerTest(BitcoinTestFramework): ) # Handle script missing: - assert_raises_rpc_error(-1, 'execve failed: No such file or directory', - self.nodes[3].enumeratesigners + assert_raises_rpc_error( + -1, + "CreateProcess failed: The system cannot find the file specified." + if platform.system() == "Windows" + else "execve failed: No such file or directory", + self.nodes[3].enumeratesigners, ) # Handle error thrown by script diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py index 28103793df..2f0cfb6031 100755 --- a/test/functional/tool_wallet.py +++ b/test/functional/tool_wallet.py @@ -344,7 +344,7 @@ class ToolWalletTest(BitcoinTestFramework): non_exist_dump = os.path.join(self.nodes[0].datadir, "wallet.nodump") self.assert_raises_tool_error('Unknown wallet file format "notaformat" provided. Please provide one of "bdb" or "sqlite".', '-wallet=todump', '-format=notaformat', '-dumpfile={}'.format(wallet_dump), 'createfromdump') self.assert_raises_tool_error('Dump file {} does not exist.'.format(non_exist_dump), '-wallet=todump', '-dumpfile={}'.format(non_exist_dump), 'createfromdump') - wallet_path = os.path.join(self.nodes[0].datadir, 'regtest/wallets/todump2') + wallet_path = os.path.join(self.nodes[0].datadir, 'regtest', 'wallets', 'todump2') self.assert_raises_tool_error('Failed to create database path \'{}\'. Database already exists.'.format(wallet_path), '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump') self.assert_raises_tool_error("The -descriptors option can only be used with the 'create' command.", '-descriptors', '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump') |