Skip to content

Commit 81a676c

Browse files
committed
Merge branch 'main' into rel-1.5.0
2 parents 94d742c + 06e67b7 commit 81a676c

File tree

4 files changed

+40
-32
lines changed

4 files changed

+40
-32
lines changed

e2e_tests/test_executable.py

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
import subprocess
66
import time
77
from pathlib import Path
8-
from typing import Any
9-
10-
from openhands.sdk import LLM
11-
from openhands_cli.locations import AGENT_SETTINGS_PATH, PERSISTENCE_DIR
12-
from openhands_cli.utils import get_default_cli_agent
138

149
from .models import TestResult
10+
from .utils import seed_dummy_settings
1511

1612

1713
WELCOME_MARKERS = ["welcome", "openhands cli", "type /help", "available commands", ">"]
@@ -30,28 +26,7 @@ def test_executable() -> TestResult:
3026

3127
try:
3228
# Create dummy agent settings
33-
from openhands_cli.utils import (
34-
get_llm_metadata,
35-
should_set_litellm_extra_body,
36-
)
37-
38-
model_name = "dummy-model"
39-
extra_kwargs: dict[str, Any] = {}
40-
if should_set_litellm_extra_body(model_name):
41-
extra_kwargs["litellm_extra_body"] = {
42-
"metadata": get_llm_metadata(
43-
model_name=model_name, llm_type="openhands"
44-
)
45-
}
46-
llm = LLM(model=model_name, api_key="dummy-key", **extra_kwargs)
47-
dummy_agent = get_default_cli_agent(llm=llm)
48-
49-
spec_path = os.path.join(PERSISTENCE_DIR, AGENT_SETTINGS_PATH)
50-
specs_path = Path(os.path.expanduser(spec_path))
51-
52-
if not specs_path.exists():
53-
specs_path.parent.mkdir(parents=True, exist_ok=True)
54-
specs_path.write_text(dummy_agent.model_dump_json())
29+
seed_dummy_settings()
5530

5631
exe_path = Path("dist/openhands")
5732
if not exe_path.exists():

e2e_tests/test_experimental_ui.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from pathlib import Path
88

99
from .models import TestResult
10+
from .utils import seed_dummy_settings
1011

1112

1213
def test_experimental_ui() -> TestResult:
@@ -15,6 +16,8 @@ def test_experimental_ui() -> TestResult:
1516
start_time = time.time()
1617

1718
try:
19+
seed_dummy_settings()
20+
1821
exe_path = Path("dist/openhands")
1922
if not exe_path.exists():
2023
exe_path = Path("dist/openhands.exe")
@@ -49,9 +52,7 @@ def test_experimental_ui() -> TestResult:
4952

5053
# Markers that indicate the textual UI has started
5154
ui_markers = [
52-
"openhands",
53-
"conversation",
54-
"initialized",
55+
"initialized conversation",
5556
"what do you want to build",
5657
]
5758

@@ -64,11 +65,12 @@ def test_experimental_ui() -> TestResult:
6465
if not rlist:
6566
continue
6667
line = proc.stdout.readline()
68+
6769
if not line:
6870
continue
6971
captured.append(line)
70-
line_lower = line.strip().lower()
71-
if any(marker in line_lower for marker in ui_markers):
72+
if any(marker.lower() in line.lower() for marker in ui_markers):
73+
print("fouind marker in line", line)
7274
saw_ui_start = True
7375
break
7476

e2e_tests/utils.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import os
2+
from pathlib import Path
3+
from typing import Any
4+
5+
from openhands.sdk import LLM
6+
from openhands_cli.locations import AGENT_SETTINGS_PATH, PERSISTENCE_DIR
7+
from openhands_cli.utils import (
8+
get_default_cli_agent,
9+
get_llm_metadata,
10+
should_set_litellm_extra_body,
11+
)
12+
13+
14+
def seed_dummy_settings():
15+
model_name = "dummy-model"
16+
extra_kwargs: dict[str, Any] = {}
17+
if should_set_litellm_extra_body(model_name):
18+
extra_kwargs["litellm_extra_body"] = {
19+
"metadata": get_llm_metadata(model_name=model_name, llm_type="openhands")
20+
}
21+
llm = LLM(model=model_name, api_key="dummy-key", **extra_kwargs)
22+
dummy_agent = get_default_cli_agent(llm=llm)
23+
24+
spec_path = os.path.join(PERSISTENCE_DIR, AGENT_SETTINGS_PATH)
25+
specs_path = Path(os.path.expanduser(spec_path))
26+
27+
if not specs_path.exists():
28+
specs_path.parent.mkdir(parents=True, exist_ok=True)
29+
specs_path.write_text(dummy_agent.model_dump_json())

openhands-cli.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ a = Analysis(
3434
*collect_data_files('mcp'),
3535
# Include all data files from openhands.sdk (templates, configs, etc.)
3636
*collect_data_files('openhands.sdk'),
37+
# Include all data files from openhands_cli package
38+
*collect_data_files('openhands_cli'),
3739
# Include package metadata for importlib.metadata
3840
*copy_metadata('fastmcp'),
3941
*copy_metadata('agent-client-protocol'),

0 commit comments

Comments
 (0)