Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion omlx/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ def launch_command(args):
# Check if oMLX server is running
base_url = f"http://{host}:{port}"
try:
resp = requests.get(f"{base_url}/health", timeout=3)
session = requests.Session()
session.trust_env = False
resp = session.get(f"{base_url}/health", timeout=3)
resp.raise_for_status()
except Exception:
print(f"oMLX server is not running at {base_url}")
Expand Down
16 changes: 12 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,18 @@ def test_launch_command_passes_model_type_to_integration(self):
tools_profile="coding",
)

with patch("requests.get", side_effect=[health_response, status_response]):
with patch("omlx.integrations.get_integration", return_value=integration):
with patch("omlx.settings.GlobalSettings.load", return_value=settings):
launch_command(args)
session = MagicMock()
session.get.return_value = health_response

with patch("requests.Session", return_value=session) as session_ctor:
with patch("requests.get", return_value=status_response):
with patch("omlx.integrations.get_integration", return_value=integration):
with patch("omlx.settings.GlobalSettings.load", return_value=settings):
launch_command(args)

session_ctor.assert_called_once()
assert session.trust_env is False
session.get.assert_called_once_with("http://127.0.0.1:8000/health", timeout=3)

integration.launch.assert_called_once_with(
port=8000,
Expand Down