Skip to content

Conversation

@cleemullins
Copy link
Collaborator

@cleemullins cleemullins commented Oct 13, 2025

Fixes #163

A half dozen methods started with "test" that were not intended to be actual tests. PyTest tries to run these and generates warnings as their return types are not correct. This results in PyTest warnings that look like:

tests/hosting_core/_oauth/test_oauth_flow.py::testing_Activity
  D:\git\Agents-for-python\venv\Lib\site-packages\_pytest\python.py:161: PytestReturnNotNoneWarning: Test functions should return None, but tests/hosting_core/_oauth/test_oauth_flow.py::testing_Activity returned <class 'microsoft_agents.activity.activity.Activity'>.
...

Pytest picks up any function/class that starts with "test" as an actual test. The easiest fix for these is to simply rename them to NOT start with test. All functions encoutered as part of this are actually creating Mocks or similar testing entities for use by other tests.

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 refactors function names in test files to prevent PyTest from incorrectly identifying them as test cases. Functions that previously started with "test" but were utility functions for creating test objects are renamed to start with "create_" instead.

  • Renamed utility functions from testing_* to create_testing_* pattern
  • Updated all references to use the new naming scheme
  • Removed extraneous blank lines for cleaner formatting

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/hosting_core/app/_oauth/_common.py Renamed utility functions testing_Activity, testing_TurnContext, and testing_TurnContext_magic to use create_ prefix
tests/hosting_core/app/_oauth/test_authorization.py Updated imports and references to use new function names
tests/hosting_core/app/_oauth/_handlers/test_user_authorization.py Updated function definition and reference to use new naming scheme
tests/hosting_core/app/_oauth/_handlers/test_agentic_user_authorization.py Updated import and reference to use new function names
tests/hosting_core/_oauth/test_oauth_flow.py Updated function definition and reference to use new naming scheme

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@cleemullins cleemullins requested a review from axelsrz October 13, 2025 21:48
@cleemullins cleemullins self-assigned this Oct 13, 2025
@cleemullins cleemullins added Bug Something isn't working P1 labels Oct 13, 2025
@cleemullins cleemullins enabled auto-merge (squash) October 13, 2025 21:50
@cleemullins cleemullins merged commit 92be5d1 into main Oct 13, 2025
8 checks passed
@cleemullins cleemullins deleted the users/cleemullins/CleanupIncorrectlyNamedTestFunctions branch October 13, 2025 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working P1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warnings around assertions vs return values in Unit Tests

3 participants