diff --git a/omlx/cli.py b/omlx/cli.py index 2262d9ab..3fef86ff 100644 --- a/omlx/cli.py +++ b/omlx/cli.py @@ -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}") diff --git a/tests/test_cli.py b/tests/test_cli.py index c1f689b1..2890b8d7 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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,