Skip to content

Conversation

@dargilco
Copy link
Member

@dargilco dargilco commented Dec 5, 2025

When I run my tests (Python version 3.14) I keep getting the two warnings below. Fixing them in this PR

============================================================================================ test session starts ============================================================================================
platform win32 -- Python 3.14.0, pytest-9.0.1, pluggy-1.6.0
rootdir: e:\src\sdk-repos\azure-sdk-for-python
configfile: setup.cfg
plugins: anyio-4.11.0, asyncio-1.3.0, cov-7.0.0
asyncio: mode=Mode.STRICT, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 2 items

tests\agents\tools\test_agent_image_generation.py .                                                                                                                                                    [ 50%]
tests\agents\tools\test_agent_image_generation_async.py .                                                                                                                                              [100%]

============================================================================================= warnings summary ==============================================================================================
sdk/ai/azure-ai-projects/tests/agents/tools/test_agent_image_generation.py::TestAgentImageGeneration::test_agent_image_generation
sdk/ai/azure-ai-projects/tests/agents/tools/test_agent_image_generation_async.py::TestAgentImageGenerationAsync::test_agent_image_generation_async
  E:\src\sdk-repos\azure-sdk-for-python-2\eng\tools\azure-sdk-tools\devtools_testutils\envvariable_loader.py:71: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
    _logger.warn(

sdk/ai/azure-ai-projects/tests/agents/tools/test_agent_image_generation.py::TestAgentImageGeneration::test_agent_image_generation
sdk/ai/azure-ai-projects/tests/agents/tools/test_agent_image_generation_async.py::TestAgentImageGenerationAsync::test_agent_image_generation_async
  E:\src\sdk-repos\azure-sdk-for-python-2\eng\tools\azure-sdk-tools\devtools_testutils\preparers.py:148: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead
    if asyncio.iscoroutinefunction(fn):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================= 2 passed, 4 warnings in 71.62s (0:01:11) ==================================================================================

Copilot AI review requested due to automatic review settings December 5, 2025 15:44
@dargilco dargilco self-assigned this Dec 5, 2025
Copilot finished reviewing on behalf of dargilco December 5, 2025 15:46
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 addresses two deprecation warnings that appear when running tests with Python 3.14 in the devtools_testutils testing framework.

Key Changes:

  • Replaced deprecated asyncio.iscoroutinefunction() with inspect.iscoroutinefunction() to avoid Python 3.16 removal
  • Changed deprecated _logger.warn() to the standard _logger.warning() method

Reviewed changes

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

File Description
eng/tools/azure-sdk-tools/devtools_testutils/preparers.py Added inspect import and replaced asyncio.iscoroutinefunction() with inspect.iscoroutinefunction() for detecting coroutine functions
eng/tools/azure-sdk-tools/devtools_testutils/envvariable_loader.py Replaced deprecated _logger.warn() with _logger.warning() for logging warning messages

The changes are straightforward, correct, and properly address the deprecation warnings mentioned in the PR description. Both replacements follow Python's recommended migration path and maintain the same functionality.

Copy link
Member

@scbedd scbedd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Member

@mccoyp mccoyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for creating a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants