Browse Source

Fix tests for Core v26 when user has no access to ~/.bitcoin/settings.json

master
Kristaps Kaupe 2 years ago
parent
commit
935a734b93
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 6
      conftest.py
  2. 2
      test/run_tests.sh

6
conftest.py

@ -8,12 +8,12 @@ from typing import Any, Tuple
import pytest 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 This utility function returns the bitcoind version number
as a tuple in the form (major, minor) 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: if version.returncode != 0:
raise RuntimeError(version.stdout.decode('utf-8')) raise RuntimeError(version.stdout.decode('utf-8'))
version_string = version.stdout.split(b'\n')[0] version_string = version.stdout.split(b'\n')[0]
@ -141,7 +141,7 @@ def setup_regtest_bitcoind(pytestconfig):
# determine bitcoind version # determine bitcoind version
try: try:
bitcoind_version = get_bitcoind_version(bitcoind_path) bitcoind_version = get_bitcoind_version(bitcoind_path, conf)
except RuntimeError as exc: except RuntimeError as exc:
pytest.exit(f"Cannot setup tests, bitcoind failing.\n{exc}") pytest.exit(f"Cannot setup tests, bitcoind failing.\n{exc}")

2
test/run_tests.sh

@ -211,7 +211,7 @@ run_jm_tests ()
else else
bitcoind="bitcoind" bitcoind="bitcoind"
fi 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" echo "deprecatedrpc=create_bdb" >> "${jm_test_datadir}/bitcoin.conf"
fi fi
fi fi

Loading…
Cancel
Save