Skip to content

test: raise code coverage to ~98% for MER KPI (PRODEV-612) - #233

Merged
edis-uipath merged 1 commit into
mainfrom
mer/increase-coverage
Jul 29, 2026
Merged

test: raise code coverage to ~98% for MER KPI (PRODEV-612)#233
edis-uipath merged 1 commit into
mainfrom
mer/increase-coverage

Conversation

@PopescuTudor

@PopescuTudor PopescuTudor commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Why

MER KPI #10 "Increase Code Coverage" (PRODEV-612) is red: SonarCloud main-branch coverage was 65.6%, below the 80% guardrail.

What

Adds unit tests to lift SonarCloud main-branch coverage from 65.6% → ~98% (local: 1177 stmts, 19 missed = 98.39%). No source changes.

File Module Before → After
tests/test_diagnose.py _diagnose.py 0% → 100%
tests/cli/test_token_refresh_more.py _token_refresh.py 68% → 100%
tests/cli/test_session_more.py _session.py 65% → 98.6%
tests/cli/test_runtime_extra.py _runtime.py 44% → 96.9%

Verification

  • uv run pytest — 203 passed
  • uv run mypy — no issues
  • uv run ruff check . / ruff format --check . — clean

Follow-ups (not in this PR)

  • Add SonarCloud as a required status check on main branch protection so coverage can't regress (as done for the sibling SDK repos).
  • Confirm Service Catalog maps sonarProjectKeys: UiPath_uipath-mcp-python.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 28, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds additional unit tests to significantly increase overall code coverage (targeting ~98%) for the CLI runtime and utility modules, without changing any production source code.

Changes:

  • Added a new test suite for _diagnose.diagnose_binary covering OS/arch and subprocess error branches.
  • Added new async tests for _token_refresh.TokenRefresher covering lifecycle, refresh loop behavior, and both OAuth/client-credentials flows.
  • Added new async tests for _session and _runtime to cover additional relay/consume paths and HTTP-process lifecycle/cleanup/keep-alive branches.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/test_diagnose.py New unit tests for binary diagnostics helper, including Linux ELF/readelf and non-Linux file-command branches.
tests/cli/test_token_refresh_more.py Expanded async coverage for token refresh strategies, loops, retries, and refresh implementations.
tests/cli/test_session_more.py Added session-server tests for relay/consume loops and start/run error-handling paths.
tests/cli/test_runtime_extra.py Added broad runtime tests for HTTP server process management, registration, cleanup, and keep-alive behaviors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@PopescuTudor PopescuTudor self-assigned this Jul 28, 2026
@PopescuTudor
PopescuTudor force-pushed the mer/increase-coverage branch from 2a010da to 73d82ec Compare July 29, 2026 12:08
Add unit tests to lift SonarCloud main-branch coverage from 65.6% to ~98%,
clearing the 80% MER "Increase Code Coverage" guardrail (PRODEV-612).

- tests/test_diagnose.py: full coverage of the binary diagnostics helper
  (previously 0%, untested).
- tests/cli/test_token_refresh_more.py: refresh loop, oauth/client-credentials
  flows, lifecycle, and retry/cancel paths.
- tests/cli/test_session_more.py: relay loop, consumer drain/error paths,
  stdio/http run flows and start-error handling.
- tests/cli/test_runtime_extra.py: HTTP process lifecycle, monitor, cleanup,
  registration (stdio + streamable-http), run-server orchestration, keep-alive.

No source changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@PopescuTudor
PopescuTudor force-pushed the mer/increase-coverage branch from 73d82ec to 82e4884 Compare July 29, 2026 14:26
@sonarqubecloud

Copy link
Copy Markdown

@edis-uipath
edis-uipath merged commit 6226a43 into main Jul 29, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants