Add unit test coverage and CI coverage reporting#158
Merged
abelmilash-msft merged 19 commits intomainfrom Apr 10, 2026
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the unit test suite to significantly increase coverage across the Dataverse client (including internal OData helpers), and updates both CI pipelines to publish JUnit test results and Cobertura-style coverage XML artifacts.
Changes:
- Added extensive new unit tests for core HTTP/auth, OData internals, upload + relationship helpers, and public operation namespaces.
- Extended existing unit tests to cover additional input validation and internal edge cases.
- Updated GitHub Actions and Azure DevOps pipelines to emit and publish JUnit XML + coverage XML outputs.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/python-package.yml |
Runs pytest with JUnit + coverage reporting and uploads artifacts. |
.azdo/ci-pr.yaml |
Runs pytest with JUnit + coverage reporting and publishes results in ADO. |
tests/unit/core/test_auth.py |
Adds unit tests for credential validation + token acquisition. |
tests/unit/core/test_http_client.py |
Adds unit tests for timeout defaults, session routing, and retry/backoff. |
tests/unit/core/test_http_errors.py |
Adds instantiation tests for error types and optional HttpError diagnostic fields. |
tests/unit/data/test_odata_internal.py |
Adds/extends broad internal _ODataClient coverage (CRUD, metadata, caching, etc.). |
tests/unit/data/test_relationships.py |
Adds tests for relationship creation including solution header behavior. |
tests/unit/data/test_upload.py |
Adds comprehensive tests for small/chunk upload paths and orchestration logic. |
tests/unit/models/test_query_builder.py |
Adds a test for handling plain-string internal filter parts. |
tests/unit/models/test_table_info.py |
Adds tests for non-string membership checks and legacy values/items behavior. |
tests/unit/test_client.py |
Adds base URL validation test. |
tests/unit/test_context_manager.py |
Adds delegation test for DataverseClient.flush_cache(). |
tests/unit/test_records_operations.py |
Adds input/type validation tests for RecordOperations CRUD behaviors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d5ee154 to
9361629
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… cases Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… rendering Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sagebree
approved these changes
Apr 10, 2026
Contributor
sagebree
left a comment
There was a problem hiding this comment.
Ensure Azure DevOps pipeline approval is completed so coverage reporting is re-enabled
maksii
added a commit
to maksii/PowerPlatform-DataverseClient-Python
that referenced
this pull request
Apr 10, 2026
Incorporate latest changes from microsoft/PowerPlatform-DataverseClient-Python: - Batch API with changeset, upsert, and DataFrame integration (microsoft#129) - Optimize picklist label resolution with bulk fetch (microsoft#154) - Add memo/multiline column type support (microsoft#155) - Add unit test coverage and CI coverage reporting (microsoft#158) Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive unit tests across 13 test files and enables coverage reporting and enforcement in both CI pipelines and
pyproject.toml. Coverage increased from 72% to 93%.Coverage enforcement is now built into both CI pipelines and the project config: overall coverage must stay at or above 90% (
fail_under = 90inpyproject.toml), and any new code introduced in a PR must also meet 90% (diff-cover).Test Results
Changes
Configuration (2 files)
pyproject.toml: Added[tool.coverage.run](source = ["src/PowerPlatform"]) and[tool.coverage.report](fail_under = 90,show_missing = true) to centralize coverage configpyproject.toml: Addeddiff-coverdev dependency for PR-level coverage enforcementCI Pipelines (2 files)
.github/workflows/python-package.yml: AddedPYTHONPATH=src pytest --cov --cov-report=xml --junitxml=test-results.xml,diff-coverstep to enforce 90% on new changes,fetch-depth: 0for full git history, and artifact upload steps.azdo/ci-pr.yaml: Same pytest and diff-cover steps, addedPublishTestResults@2andPublishCodeCoverageResults@2tasksNew Test Files (6 files)
test_auth.py: Credential validation, token acquisition (2 tests)test_http_client.py: Timeout selection, session routing, retry behavior (15 tests)test_http_errors.py: Error response parsing, correlation IDs, transient detection (9 tests)test_upload.py: File upload orchestrator, small upload, chunked streaming (50+ tests)test_relationships.py: 1:N and M:N relationship CRUD (25+ tests)test_records_operations.py: Public records API delegation (30+ tests)Expanded Test Files (7 files)
test_odata_internal.py: 36 test classes, 219 tests covering all_ODataClientmethods — CRUD, upsert, bulk operations, metadata, caching, picklist resolution, pagination, SQL queries, alternate keys, column management. Includes kwarg correctness audit (json=vsdata=), response content validation, and assertion strengthening.test_batch_serialization.py: 7 new test classes (26 tests) — dispatch routing for all intent types, changeset validation, metadata resolution, continue-on-error header, MIME parsing edge casestest_query_builder.py,test_table_info.py,test_client.py,test_context_manager.py,test_records_operations.py: Docstrings added to existing tests