mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
Merge bitcoin/bitcoin#28213: scripted-diff: Specify Python major version explicitly on Windows
6a7686b446
scripted-diff: Specify Python major version explicitly on Windows (Hennadii Stepanov) Pull request description: On Windows, it is the accepted practice to use `py.exe` launcher: - https://learn.microsoft.com/en-us/windows/python/faqs#what-is-py-exe- - https://docs.python.org/3/using/windows.html#python-launcher-for-windows One of its features is the correct handling of shebang lines like the one we use: `#!/usr/bin/env python3`. However, Windows OS app execution aliases might [interfere](https://learn.microsoft.com/en-us/windows/python/faqs#why-does-running-python-exe-open-the-microsoft-store-) with the launcher's behaviour. Such aliases are enabled on Windows 11 by default: ![image](https://github.com/bitcoin/bitcoin/assets/32963518/407837ec-e89a-4bc1-98b1-db983002065a) For example, on a fresh Windows 11 Pro installation with the Python installed from the [Chocolatey](https://community.chocolatey.org/packages/python/3.11.4) package manager, one will get the following error: ``` >py -3 test\functional\rpc_signer.py 2023-08-03T19:41:13.353000Z TestFramework (INFO): PRNG seed is: 2694758731106548661 2023-08-03T19:41:13.353000Z TestFramework (INFO): Initializing test directory C:\Users\hebasto\AppData\Local\Temp\bitcoin_func_test_mldbzzw3 2023-08-03T19:41:14.538000Z TestFramework (ERROR): Assertion failed Traceback (most recent call last): File "C:\Users\hebasto\bitcoin\test\functional\test_framework\util.py", line 140, in try_rpc fun(*args, **kwds) File "C:\Users\hebasto\bitcoin\test\functional\test_framework\coverage.py", line 50, in __call__ return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hebasto\bitcoin\test\functional\test_framework\authproxy.py", line 129, in __call__ raise JSONRPCException(response['error'], status) test_framework.authproxy.JSONRPCException: RunCommandParseJSON error: process(py C:\Users\hebasto\bitcoin\test\functional\mocks\signer.py enumerate) returned 9009: Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases. (-1) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\hebasto\bitcoin\test\functional\test_framework\test_framework.py", line 131, in main self.run_test() File "C:\Users\hebasto\bitcoin\test\functional\rpc_signer.py", line 72, in run_test assert_raises_rpc_error(-1, 'fingerprint not found', File "C:\Users\hebasto\bitcoin\test\functional\test_framework\util.py", line 131, in assert_raises_rpc_error assert try_rpc(code, message, fun, *args, **kwds), "No exception raised" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hebasto\bitcoin\test\functional\test_framework\util.py", line 146, in try_rpc raise AssertionError( AssertionError: Expected substring not found in error message: substring: 'fingerprint not found' error message: 'RunCommandParseJSON error: process(py C:\Users\hebasto\bitcoin\test\functional\mocks\signer.py enumerate) returned 9009: Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases. '. 2023-08-03T19:41:14.592000Z TestFramework (INFO): Stopping nodes 2023-08-03T19:41:14.799000Z TestFramework (WARNING): Not cleaning up dir C:\Users\hebasto\AppData\Local\Temp\bitcoin_func_test_mldbzzw3 2023-08-03T19:41:14.799000Z TestFramework (ERROR): Test failed. Test logging available at C:\Users\hebasto\AppData\Local\Temp\bitcoin_func_test_mldbzzw3/test_framework.log 2023-08-03T19:41:14.799000Z TestFramework (ERROR): 2023-08-03T19:41:14.799000Z TestFramework (ERROR): Hint: Call C:\Users\hebasto\bitcoin\test\functional\combine_logs.py 'C:\Users\hebasto\AppData\Local\Temp\bitcoin_func_test_mldbzzw3' to consolidate all logs 2023-08-03T19:41:14.799000Z TestFramework (ERROR): 2023-08-03T19:41:14.799000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log. 2023-08-03T19:41:14.799000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues 2023-08-03T19:41:14.799000Z TestFramework (ERROR): ``` This PR resolves this issue by explicitly specifying the Python major version and makes testing of self-compiled binaries more straightforward. ACKs for top commit: MarcoFalke: lgtm ACK6a7686b446
stickies-v: utACK6a7686b446
Tree-SHA512: 5681141e222bc833c6250cb79fe3a1c8e02255eb2c86010bc0f8239afcdfed784ed7788c8579209d931bd357f58d5655cf33ffeb2f46b1879f37cdc30e7a7c91
This commit is contained in:
commit
d096743150
2 changed files with 4 additions and 4 deletions
|
@ -21,7 +21,7 @@ class RPCSignerTest(BitcoinTestFramework):
|
||||||
def mock_signer_path(self):
|
def mock_signer_path(self):
|
||||||
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'signer.py')
|
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'signer.py')
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
return "py " + path
|
return "py -3 " + path
|
||||||
else:
|
else:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
|
@ -25,21 +25,21 @@ class WalletSignerTest(BitcoinTestFramework):
|
||||||
def mock_signer_path(self):
|
def mock_signer_path(self):
|
||||||
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'signer.py')
|
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'signer.py')
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
return "py " + path
|
return "py -3 " + path
|
||||||
else:
|
else:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def mock_invalid_signer_path(self):
|
def mock_invalid_signer_path(self):
|
||||||
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'invalid_signer.py')
|
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'invalid_signer.py')
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
return "py " + path
|
return "py -3 " + path
|
||||||
else:
|
else:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def mock_multi_signers_path(self):
|
def mock_multi_signers_path(self):
|
||||||
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'multi_signers.py')
|
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'multi_signers.py')
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
return "py " + path
|
return "py -3 " + path
|
||||||
else:
|
else:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue