Skip to content

Conversation

@Rishabh4275
Copy link
Contributor

@Rishabh4275 Rishabh4275 commented Jan 30, 2026

Motivation and Context

Add Tests for test coverage

Description

Add Tests for test coverage. Increased test coverage from 84 to 89 percent.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings January 30, 2026 05:37
Copy link
Contributor

Copilot AI left a comment

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 extends the Purview Python package’s test suite to cover additional edge cases in the processor, middleware, client, and cache components, with a focus on payment-required behavior, correlation IDs, caching semantics, and error handling.

Changes:

  • Added processor tests around corrupted cache entries, tenant-level payment-required exception caching, and background re-processing behavior when scopes are modified.
  • Expanded middleware and chat middleware tests to cover streaming behavior, 402 Payment Required handling, and ignore_exceptions behavior in both pre- and post-check paths.
  • Extended Purview client and cache tests to cover correlation ID propagation, 402 handling, deserialization failures, invalid JSON bodies, ContentActivities calls, and conservative cache size-estimation fallbacks.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
python/packages/purview/tests/test_processor.py Adds tests for cache behavior (including corrupted entries), tenant-level payment-required caching, and background retry logic when protection scopes change.
python/packages/purview/tests/test_middleware.py Adds agent middleware tests for streaming (post-check skip), 402 behavior, and exception propagation based on ignore_payment_required and ignore_exceptions.
python/packages/purview/tests/test_client.py Extends client tests to cover ETag header precedence, 402 handling (both _post and process_content), correlation ID header/span behavior, deserialization-fallback paths, and content activities.
python/packages/purview/tests/test_chat_middleware.py Adds chat middleware tests for 402 behavior and exception propagation in pre- and post-checks, mirroring agent middleware semantics.
python/packages/purview/tests/test_cache.py Adds a test ensuring _estimate_size falls back to a conservative size when both JSON serialization and sys.getsizeof fail.

@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jan 30, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/purview/agent_framework_purview
   _processor.py1641093%160, 236–239, 244, 272, 274, 280, 282
TOTAL16248198287% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3740 221 💤 0 ❌ 0 🔥 1m 8s ⏱️

@Rishabh4275 Rishabh4275 force-pushed the users/richawla/psdkNew branch from 284e15b to ccee939 Compare January 30, 2026 22:29
@Rishabh4275 Rishabh4275 force-pushed the users/richawla/psdkNew branch from ccee939 to 9de9128 Compare January 30, 2026 23:03
@giles17 giles17 enabled auto-merge January 30, 2026 23:05
@giles17 giles17 added this pull request to the merge queue Jan 30, 2026
Merged via the queue into microsoft:main with commit 2f7250f Jan 30, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants