Skip to content

Add unit tests to raise coverage in mssql-odbc and mssql-py-core - #132

Draft
Saurabh Singh (saurabh500) wants to merge 1 commit into
mainfrom
saurabh500-add-unit-tests-coverage-pycore-odbc
Draft

Add unit tests to raise coverage in mssql-odbc and mssql-py-core#132
Saurabh Singh (saurabh500) wants to merge 1 commit into
mainfrom
saurabh500-add-unit-tests-coverage-pycore-odbc

Conversation

@saurabh500

Copy link
Copy Markdown
Contributor

Description

Follow-up to the coverage-reporting change: adds high-value unit tests (no coverage-tooling/CI changes) to the two under-covered Rust crates. All additions are #[cfg(test)] inline modules exercising pure logic and FFI null/state paths that need no live SQL Server, network, or real ODBC DSN. No production code changed (428 insertions, 0 deletions).

Coverage (line rate, own src/** only)

Crate Before After
mssql-odbc 80.99% 87.46%
mssql-py-core 20.96% 25.80%

Modules covered

mssql-odbc (cargo llvm-cov nextest --package mssql-odbc; 269 tests pass)

  • api/exports.rs — 0% → 100%: every exported SQL* entry point (null-handle → SQL_INVALID_HANDLE, stubs → SQL_SUCCESS, env alloc/free).
  • api/more_results.rs — 0% → ~55%: null handle, no-cursor → SQL_NO_DATA, busy-other-statement, no-active-client branches.
  • api/exec_direct.rs — 41% → 58%: connected-but-no-client and busy-other-statement error paths.
  • api/disconnect.rs — 73% → 88%: connected → disconnect success path.

mssql-py-core (nextest via the Linux build image; 96 tests pass)

  • row_writer.rs — 0% → 94%: all RowWriter::write_* impls asserting accumulated ColumnValues.
  • types.rs — 18.66% → 29.29%: validate_type_compatibility compatible/mismatch/Variant/Null match arms.

Tests follow existing sibling #[cfg(test)] conventions and the repo's terse style.

Related Issues

N/A — no GitHub issue or Azure DevOps work item was provided for this follow-up.

Checklist

  • cargo bfmt passes (workspace; py-core cargo fmt --check confirmed in the Linux build image)
  • cargo bclippy passes (workspace + py-core, -D warnings clean)
  • cargo btest passes (odbc 269 tests; py-core 96 tests via the build image)
  • New/changed functionality has tests
  • Public API changes are documented — N/A (no public API changes)

Cover FFI null/state paths in mssql-odbc (exports, more_results,
exec_direct, disconnect) and pure logic in mssql-py-core (row_writer
write_* impls, types validate_type_compatibility). No production changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 65394310-2a36-4e2d-80fa-1adff74cd509
@github-actions

Copy link
Copy Markdown

📊 Code Coverage Report

🔥 Diff Coverage

100%

🎯 Overall Coverage

90.9%

📦 Project: mssql-tds + mssql-py-core
ℹ️ Note: diff coverage is reported, not enforced.


Diff Coverage

Diff: main...HEAD, staged and unstaged changes

No lines with coverage information in this diff.


🔗 Quick Links

View Azure DevOps Build · Coverage Report

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.

1 participant