Skip to content

Commit 091dbd0

Browse files
authored
Merge pull request #1 from UiPath/fix/tests_lint
fix: typing and dummy test
2 parents 3104c06 + 9aa2665 commit 091dbd0

File tree

6 files changed

+22
-7
lines changed

6 files changed

+22
-7
lines changed

src/uipath/dev/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
import traceback
66
from datetime import datetime
77
from pathlib import Path
8-
from typing import Any
8+
from typing import Any, Optional
99

1010
import pyperclip # type: ignore[import-untyped]
11+
from pydantic import BaseModel
1112
from rich.traceback import Traceback
1213
from textual import on
1314
from textual.app import App, ComposeResult
@@ -128,7 +129,7 @@ async def handle_chat_input(self, event: Input.Submitted) -> None:
128129
)
129130
return
130131
if details_panel.current_run.status == "suspended":
131-
details_panel.current_run.resume_data = user_text
132+
details_panel.current_run.resume_data = {"message": user_text}
132133
asyncio.create_task(self._execute_runtime(details_panel.current_run))
133134
event.input.clear()
134135

@@ -190,7 +191,7 @@ def action_copy(self) -> None:
190191
async def _execute_runtime(self, run: ExecutionRun):
191192
"""Execute the script using UiPath runtime."""
192193
try:
193-
execution_input: dict[str, Any] = {}
194+
execution_input: Optional[dict[str, Any]] = {}
194195
execution_options: UiPathExecuteOptions = UiPathExecuteOptions()
195196
if run.status == "suspended":
196197
execution_input = run.resume_data
@@ -216,7 +217,12 @@ async def _execute_runtime(self, run: ExecutionRun):
216217
):
217218
run.status = "suspended"
218219
else:
219-
run.output_data = result.output
220+
if result.output is None:
221+
run.output_data = {}
222+
elif isinstance(result.output, BaseModel):
223+
run.output_data = result.output.model_dump()
224+
else:
225+
run.output_data = result.output
220226
run.status = "completed"
221227
if run.output_data:
222228
self._add_info_log(run, f"Execution result: {run.output_data}")

src/uipath/dev/_demo/mock_runtime.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class MockRuntime(UiPathBaseRuntime):
1818

1919
async def get_schema(self) -> UiPathRuntimeSchema:
2020
return UiPathRuntimeSchema(
21+
filePath="default",
22+
uniqueId="mock-runtime",
23+
type="agent",
2124
input={
2225
"type": "object",
2326
"properties": {"message": {"type": "string"}},

src/uipath/dev/models/execution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(
2525
self.entrypoint = entrypoint
2626
self.input_data = input_data
2727
self.conversational = conversational
28-
self.resume_data: Optional[Any] = None
28+
self.resume_data: Optional[dict[str, Any]] = None
2929
self.output_data: Optional[dict[str, Any]] = None
3030
self.start_time = datetime.now()
3131
self.end_time: Optional[datetime] = None

src/uipath/dev/models/messages.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Messages used for inter-component communication in the UiPath Developer Console."""
2+
13
from datetime import datetime
24
from typing import Any, Optional, Union
35

@@ -15,6 +17,7 @@ def __init__(
1517
message: Union[str, RenderableType],
1618
timestamp: Optional[datetime] = None,
1719
):
20+
"""Initialize a LogMessage instance."""
1821
self.run_id = run_id
1922
self.level = level
2023
self.message = message
@@ -37,6 +40,7 @@ def __init__(
3740
timestamp: Optional[datetime] = None,
3841
attributes: Optional[dict[str, Any]] = None,
3942
):
43+
"""Initialize a TraceMessage instance."""
4044
self.run_id = run_id
4145
self.span_name = span_name
4246
self.span_id = span_id

tests/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
"""Shared pytest fixtures for all tests."""
2-
3-
import pytest

tests/test_smoke.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def test_uipath_dev_has_developer_console() -> None:
2+
from uipath.dev import UiPathDeveloperConsole
3+
4+
assert UiPathDeveloperConsole is not None

0 commit comments

Comments
 (0)