Skip to content

Commit

Permalink
scripted-diff: Specify Python major version explicitly on Windows
Browse files Browse the repository at this point in the history
Using `py.exe` launcher might by fragile depending on how Python was
installed. Specifying the Python version explicitly fixes test errors
like this:
```
RunCommandParseJSON error: process(py C:\Users\hebasto\bitcoin\test\functional\mocks\signer.py enumerate) returned 9009: Python was not found...
```

-BEGIN VERIFY SCRIPT-
sed -i 's|"py "|"py -3 "|g' $(git grep -l '"py "' -- test/functional)
-END VERIFY SCRIPT-
  • Loading branch information
hebasto committed Aug 3, 2023
1 parent 123756b commit 7a75742
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/functional/rpc_signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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 " + path
return "py -3 " + path
else:
return path

Expand Down
6 changes: 3 additions & 3 deletions test/functional/wallet_signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ def add_options(self, parser):
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 " + path
return "py -3 " + path
else:
return 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 " + path
return "py -3 " + path
else:
return 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 " + path
return "py -3 " + path
else:
return path

Expand Down

0 comments on commit 7a75742

Please sign in to comment.