Conversation
There was a problem hiding this comment.
Pull request overview
Improves UIPATH_FOLDER_PATH validation feedback in the MCP runtime by making the “folder not found” error actionable (includes the provided path), and adds unit tests for the missing-vs-not-found paths.
Changes:
- Update runtime error detail when
UIPATH_FOLDER_PATHis set but resolves to no folder key. - Add async pytest coverage for both “missing env var” and “folder not found” cases.
- Add
pytest-asynciodev dependency and bump package version to0.1.3.
Reviewed changes
Copilot reviewed 3 out of 6 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/uipath_mcp/_cli/_runtime/_runtime.py |
Updates the user-facing error detail for invalid UIPATH_FOLDER_PATH. |
tests/cli/test_runtime.py |
Adds async unit tests covering missing vs invalid folder path behavior. |
pyproject.toml |
Adds pytest-asyncio to dev deps; bumps version. |
uv.lock |
Locks pytest-asyncio and reflects version/dependency updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @pytest.fixture | ||
| def runtime(): | ||
| with patch("uipath_mcp._cli._runtime._runtime.UiPath"): | ||
| rt = UiPathMcpRuntime( | ||
| server=MagicMock(), | ||
| runtime_id="test-runtime-id", | ||
| entrypoint="test-entrypoint", | ||
| ) | ||
| rt._uipath = MagicMock() | ||
| return rt |
There was a problem hiding this comment.
In these tests, runtime._run_server() will always execute the finally: await self._cleanup() path. _cleanup() calls _on_runtime_abort(), which does await self._uipath.api_client.request_async(...). Since the fixture sets rt._uipath = MagicMock(), request_async will be a plain MagicMock (not awaitable) and can raise a TypeError, masking the intended UiPathMcpRuntimeError and making the tests flaky/failing. Consider either stubbing runtime._cleanup / _on_runtime_abort in the tests, or setting runtime._uipath.api_client.request_async to an AsyncMock returning a response object with status_code/text.
44ca535 to
507935e
Compare
507935e to
c6c5533
Compare
Fixes misleading error message when
UIPATH_FOLDER_PATHpoints to a non-existent folderPreviously, when the folder path was set but invalid, the error incorrectly told users to "set the
UIPATH_FOLDER_PATHenvironment variable", even though it was already set. Now the error includes the actual folder path and tells users to verify it's valid.Also adds unit tests for both folder path error handling paths (missing vs not found).