From 935a734b933fb836508ff99a4d77f161e4ff24c4 Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Sat, 30 Dec 2023 11:39:34 +0200 Subject: [PATCH] Fix tests for Core v26 when user has no access to ~/.bitcoin/settings.json --- conftest.py | 6 +++--- test/run_tests.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conftest.py b/conftest.py index 54b6be8..1cc56d5 100644 --- a/conftest.py +++ b/conftest.py @@ -8,12 +8,12 @@ from typing import Any, Tuple import pytest -def get_bitcoind_version(bitcoind_path: str) -> Tuple[int, int]: +def get_bitcoind_version(bitcoind_path: str, conf: str) -> Tuple[int, int]: """ This utility function returns the bitcoind version number as a tuple in the form (major, minor) """ - version = local_command(f'{bitcoind_path} -version') + version = local_command(f'{bitcoind_path} -version -conf={conf}') if version.returncode != 0: raise RuntimeError(version.stdout.decode('utf-8')) version_string = version.stdout.split(b'\n')[0] @@ -141,7 +141,7 @@ def setup_regtest_bitcoind(pytestconfig): # determine bitcoind version try: - bitcoind_version = get_bitcoind_version(bitcoind_path) + bitcoind_version = get_bitcoind_version(bitcoind_path, conf) except RuntimeError as exc: pytest.exit(f"Cannot setup tests, bitcoind failing.\n{exc}") diff --git a/test/run_tests.sh b/test/run_tests.sh index 4b91e25..af4affa 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -211,7 +211,7 @@ run_jm_tests () else bitcoind="bitcoind" fi - if [[ "$($bitcoind -version | grep -Eo 'v[0-9]+')" == "v26" ]]; then + if [[ "$($bitcoind -version -datadir="${jm_test_datadir}" | grep -Eo 'v[0-9]+')" == "v26" ]]; then echo "deprecatedrpc=create_bdb" >> "${jm_test_datadir}/bitcoin.conf" fi fi