File tree Expand file tree Collapse file tree
tests/slack_cli_hooks/hooks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,8 +57,8 @@ Below is an example `/slack.json` file that overrides the default `start`:
5757``` json
5858{
5959 "hooks" : {
60- "get-hooks" : " python3 -m slack_cli_hooks.hooks.get_hooks" ,
61- "start" : " python3 app.py"
60+ "get-hooks" : " python -m slack_cli_hooks.hooks.get_hooks" ,
61+ "start" : " python app.py"
6262 }
6363}
6464```
Original file line number Diff line number Diff line change 77PROTOCOL : Protocol
88
99# Wrap sys.executable in quotes to prevent execution failures if a white space is present in the absolute python path
10- EXEC = f"'{ sys .executable } '" or "python3 "
10+ EXEC = f"'{ sys .executable } '" if sys . executable else "python "
1111
1212
1313hooks_payload = {
Original file line number Diff line number Diff line change 1+ import importlib
2+ import sys
3+ from unittest .mock import patch
4+
5+ from slack_cli_hooks .hooks import get_hooks
16from slack_cli_hooks .hooks .get_hooks import hooks_payload
27
38
49class TestGetHooks :
10+ def test_exec_uses_sys_executable (self ):
11+ with patch .object (sys , "executable" , "/usr/bin/python3" ):
12+ importlib .reload (get_hooks )
13+ assert get_hooks .EXEC == "'/usr/bin/python3'"
14+
15+ def test_exec_falls_back_to_python_when_sys_executable_is_empty (self ):
16+ with patch .object (sys , "executable" , "" ):
17+ importlib .reload (get_hooks )
18+ assert get_hooks .EXEC == "python"
19+
520 def test_hooks_payload (self ):
621 hooks = hooks_payload ["hooks" ]
722
You can’t perform that action at this time.
0 commit comments