Skip to content

Conversation

@cleemullins
Copy link
Collaborator

@cleemullins cleemullins commented Oct 14, 2025

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.

- 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.
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 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 or Mock prefix)
  • 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.

@cleemullins cleemullins enabled auto-merge (squash) October 14, 2025 20:08
@cleemullins cleemullins merged commit 288efbf into main Oct 14, 2025
8 checks passed
@cleemullins cleemullins deleted the users/cleemullins/pytestWarningFixes branch October 14, 2025 20:22
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.

Pytest warnings around Test Collection

3 participants