Skip to content

Warnings around assertions vs return values in Unit Tests #163

@cleemullins

Description

@cleemullins

When running the PyTests, the following warnings show up:

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'>.
  Did you mean to use `assert` instead of `return`?
  See https://docs.pytest.org/en/stable/how-to/assert.html#return-not-none for more information.
    warnings.warn(

tests/hosting_core/app/_oauth/_handlers/test_agentic_user_authorization.py::testing_TurnContext_magic
  D:\git\Agents-for-python\venv\Lib\site-packages\_pytest\python.py:161: PytestReturnNotNoneWarning: Test functions should return None, but tests/hosting_core/app/_oauth/_handlers/test_agentic_user_authorization.py::testing_TurnContext_magic returned <class 'unittest.mock.MagicMock'>.
  Did you mean to use `assert` instead of `return`?
  See https://docs.pytest.org/en/stable/how-to/assert.html#return-not-none for more information.
    warnings.warn(

tests/hosting_core/app/_oauth/_handlers/test_user_authorization.py::testing_TurnContext
  D:\git\Agents-for-python\venv\Lib\site-packages\_pytest\python.py:161: PytestReturnNotNoneWarning: Test functions should return None, but tests/hosting_core/app/_oauth/_handlers/test_user_authorization.py::testing_TurnContext returned <class 'unittest.mock.Mock'>.
  Did you mean to use `assert` instead of `return`?
  See https://docs.pytest.org/en/stable/how-to/assert.html#return-not-none for more information.
    warnings.warn(

tests/hosting_core/app/_oauth/test_authorization.py::testing_TurnContext
  D:\git\Agents-for-python\venv\Lib\site-packages\_pytest\python.py:161: PytestReturnNotNoneWarning: Test functions should return None, but tests/hosting_core/app/_oauth/test_authorization.py::testing_TurnContext returned <class 'unittest.mock.Mock'>.
  Did you mean to use `assert` instead of `return`?
  See https://docs.pytest.org/en/stable/how-to/assert.html#return-not-none for more information.
    warnings.warn(

tests/hosting_core/app/_oauth/test_authorization.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/app/_oauth/test_authorization.py::testing_Activity returned <class 'microsoft_agents.activity.activity.Activity'>.
  Did you mean to use `assert` instead of `return`?
  See https://docs.pytest.org/en/stable/how-to/assert.html#return-not-none for more information.
    warnings.warn(

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions