mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
Merge bitcoin/bitcoin#27884: test: Use TestNode datadir_path or chain_path where possible
aaaa3aefbdtest: Use TestNode *_path properties where possible (MarcoFalke)dddd89962btest: Allow pathlib.Path as RPC argument via authproxy (MarcoFalke)fa41614a0ascripted-diff: Use wallets_path and chain_path where possible (MarcoFalke)fa493fadfbtest: Use wallet_dir lambda in wallet_multiwallet test where possible (MarcoFalke) Pull request description: It seems inconsistent, fragile and verbose to: * Call `get_datadir_path` to recreate the path that already exists as field in TestNode * Call `os.path.join` with the hardcoded chain name or `self.chain` to recreate the TestNode `chain_path` property * Sometimes even use the hardcoded node dir name (`"node0"`) Fix all issues by using the TestNode properties. ACKs for top commit: willcl-ark: re-ACKaaaa3aefbdtheStack: Code-review ACKaaaa3aefbd🌊 Tree-SHA512: e4720278085beb8164e1fe6c1aa18f601558a9263494ce69a83764c1487007de63ebb51d1b1151862dc4d5b49ded6162a5c1553cd30ea1c28627d447db4d8e72
This commit is contained in:
@@ -3,9 +3,6 @@
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test -startupnotify."""
|
||||
|
||||
import os
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
assert_equal,
|
||||
@@ -20,12 +17,12 @@ class StartupNotifyTest(BitcoinTestFramework):
|
||||
self.num_nodes = 1
|
||||
|
||||
def run_test(self):
|
||||
tmpdir_file = os.path.join(self.options.tmpdir, NODE_DIR, FILE_NAME)
|
||||
assert not os.path.exists(tmpdir_file)
|
||||
tmpdir_file = self.nodes[0].datadir_path / FILE_NAME
|
||||
assert not tmpdir_file.exists()
|
||||
|
||||
self.log.info("Test -startupnotify command is run when node starts")
|
||||
self.restart_node(0, extra_args=[f"-startupnotify=echo '{FILE_NAME}' >> {NODE_DIR}/{FILE_NAME}"])
|
||||
self.wait_until(lambda: os.path.exists(tmpdir_file))
|
||||
self.wait_until(lambda: tmpdir_file.exists())
|
||||
|
||||
self.log.info("Test -startupnotify is executed once")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user