Cleanup test classes to eliminate warnings coming from PyTest.#168
Merged
cleemullins merged 4 commits intomainfrom Oct 14, 2025
Merged
Cleanup test classes to eliminate warnings coming from PyTest.#168cleemullins merged 4 commits intomainfrom
cleemullins merged 4 commits intomainfrom
Conversation
- Introduced `MockTestingAdapter` and `MockTestingCustomState` for unit testing. - Replaced instances of `TestingAdapter` with `MockTestingAdapter` in various test files. - Updated `test_agent_state.py` to utilize `_MockTestDataItem` instead of `TestDataItem`. - Added `ObsoleteTestClient` for potential future testing scenarios. - Refactored `test_turn_context.py` to use `_SimpleTestingAdapter` for context testing. - Ensured all tests are aligned with the new mock implementations for better isolation and control.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR eliminates pytest warnings by renaming test support classes that were incorrectly being detected as test classes by pytest's automatic discovery. The changes rename various test helper classes to use either a leading underscore or "Mock" prefix to indicate they are supporting utilities rather than test classes.
- Renamed test support classes to avoid pytest auto-discovery (using
_prefix orMockprefix) - Updated all references to the renamed classes throughout the test files
- Cleaned up an obsolete test client class name for clarity
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/hosting_core/test_turn_context.py | Renamed TestingSimpleAdapter to _SimpleTestingAdapter and updated all references |
| tests/hosting_core/storage/test_transcript_logger_middleware.py | Updated imports and references from TestingAdapter to MockTestingAdapter |
| tests/hosting_core/state/test_agent_state.py | Renamed TestDataItem to _MockTestDataItem and updated all references from TestingAdapter/TestingCustomState to their Mock prefixed versions |
| tests/_integration/common/testing_environment.py | Updated reference from TestingAdapter to MockTestingAdapter |
| tests/_common/testing_objects/mock_testing_custom_state.py | Renamed class from TestingCustomState to MockTestingCustomState |
| tests/_common/testing_objects/adapters/mock_testing_adapter.py | Renamed class from TestingAdapter to MockTestingAdapter |
| tests/_common/testing_objects/adapters/init.py | Updated exports to reflect the renamed adapter class |
| tests/_common/testing_objects/init.py | Updated imports and exports for the renamed mock classes |
| tests/_common/obsolete_test_client.py | Renamed TestClient to ObsoleteTestClient to clarify its obsolete status |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…ency across tests Enable strict "warnings as errors" in PyTest. Fix associated issues and errors that came up.
rodrigobr-msft
approved these changes
Oct 14, 2025
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.
Fixes #167
Resolved all Pytest warnings. Mostly by renaming and/or rescoping test supporting classes that were incorrectly being picked up as tests. For some classes, this was a rename. Detailed info on each issue resolves is found in #167.
Added in a pytest.ini file to automatically run all the tests in strict / warnings-as-error mode. This should cause the local builds, GitHub builds, and ADO builds to all run tests in the same way.
The only code error fixed was in the CosmosDB storage provider which was failing to close the config file after loading it to JSON. This was flagged by PyTest as a resource leak once the strict mode was enabled, so I cleaned that up.