qa: Use sys.executable when invoking other Python scripts

This change fixes tests on systems where `python3` is not available
in the `PATH`, causing the shebang `#!/usr/bin/env python3` to fail.
This commit is contained in:
Hennadii Stepanov 2024-12-19 12:53:48 +00:00
parent c1252b14d7
commit d38ade7bc4
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 6 additions and 17 deletions

View file

@ -9,6 +9,7 @@ See also wallet_signer.py for tests that require wallet context.
"""
import os
import platform
import sys
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
@ -20,10 +21,7 @@ from test_framework.util import (
class RPCSignerTest(BitcoinTestFramework):
def mock_signer_path(self):
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'signer.py')
if platform.system() == "Windows":
return "py -3 " + path
else:
return path
return sys.executable + " " + path
def set_test_params(self):
self.num_nodes = 4

View file

@ -8,7 +8,7 @@ Verify that a bitcoind node can use an external signer command
See also rpc_signer.py for tests without wallet context.
"""
import os
import platform
import sys
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
@ -24,24 +24,15 @@ class WalletSignerTest(BitcoinTestFramework):
def mock_signer_path(self):
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'signer.py')
if platform.system() == "Windows":
return "py -3 " + path
else:
return path
return sys.executable + " " + path
def mock_invalid_signer_path(self):
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'invalid_signer.py')
if platform.system() == "Windows":
return "py -3 " + path
else:
return path
return sys.executable + " " + path
def mock_multi_signers_path(self):
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'multi_signers.py')
if platform.system() == "Windows":
return "py -3 " + path
else:
return path
return sys.executable + " " + path
def set_test_params(self):
self.num_nodes = 2