KEMBAR78
Fix or silence warnings emitted by tests by dagardner-nv · Pull Request #305 · NVIDIA/NeMo-Agent-Toolkit · GitHub
Skip to content

Conversation

@dagardner-nv
Copy link
Contributor

@dagardner-nv dagardner-nv commented May 20, 2025

Description

  • pytest now runs without reporting any warnings on 3.12 (there is a warning 3.11 that pytest is unable to silence), down from 46.
  • Update code to avoid several deprecation warnings (mostly Pydantic)
  • Silence warnings being emitted by weave that we have no control over (weave triggers PydanticDeprecatedSince20 wandb/weave#4533 & SentryHubDeprecationWarning wandb/weave#3666)
  • Add a dependency on langchain-community to aiqtoolkit-test needed for the DeterministicFakeEmbedding class (this is currently a transitory dep of ragas)
  • Renamed test classes beginning with Test which were not test classes, to prevent pytest from attempting to run them.
  • Avoid mocking the asyncio.run_coroutine_threadsafe method, this ensures that coroutines are awaited.
  • Update src/aiq/eval/evaluate.py such that coroutines are only started after passing the if not session_manager.workflow.has_single_output check, and in the event of an exception, cancel any running coroutines in the exception handler.
  • Ignore syntax warnings being emitted by qdrant-client used by mem0, remove once the fix for Invalid escape sequence produces SyntaxWarning on run qdrant/qdrant-client#983 is released.

Closes #308

By Submitting this PR I confirm:

  • I am familiar with the Contributing Guidelines.
  • We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
    • Any contribution which contains commits that are not Signed-Off will not be accepted.
  • When the PR is ready for review, new or existing tests cover these changes.
  • When the PR is ready for review, the documentation is up to date with these changes.

…being unset

Signed-off-by: David Gardner <dagardner@nvidia.com>
…ing about this not being set. Remove definition of pytest_plugins this is not a supported pytest config and triggers a warning

Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
…classes to be collected

Signed-off-by: David Gardner <dagardner@nvidia.com>
…classes to be collected

Signed-off-by: David Gardner <dagardner@nvidia.com>
…re being emitted

Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
…ment

Signed-off-by: David Gardner <dagardner@nvidia.com>
…dependency on langchain-community (this is currently a transitory dep of ragas)

Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
…ove-warnings

Signed-off-by: David Gardner <dagardner@nvidia.com>
@dagardner-nv dagardner-nv self-assigned this May 20, 2025
@dagardner-nv dagardner-nv added bug Something isn't working non-breaking Non-breaking change labels May 20, 2025
@dagardner-nv dagardner-nv marked this pull request as draft May 20, 2025 23:07
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
@dagardner-nv dagardner-nv marked this pull request as ready for review May 21, 2025 14:40
Signed-off-by: David Gardner <dagardner@nvidia.com>
…use new fixture

Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
… pull_intermediate, avoids issue where pull_intermediate is left unawaited when the workflow has multiple outputs

Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
…e) to avoid warning from the nim client

Signed-off-by: David Gardner <dagardner@nvidia.com>
… mem0), remove once qdrant/qdrant-client#983 is resolved

Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
…nore, since this warning was also bein emitted from other parts of the code base

Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
…ove-warnings

Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
@dagardner-nv dagardner-nv marked this pull request as draft May 22, 2025 15:03
Signed-off-by: David Gardner <dagardner@nvidia.com>
…thon 3.11

Signed-off-by: David Gardner <dagardner@nvidia.com>
@dagardner-nv dagardner-nv marked this pull request as ready for review May 22, 2025 16:10
@AnuradhaKaruppiah AnuradhaKaruppiah requested a review from Copilot May 27, 2025 18:55
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 various warning messages and deprecation issues while also improving asynchronous handling and renaming test classes to avoid unintended test discovery by pytest. Key changes include:

  • Suppressing and fixing deprecation and syntax warnings, notably for Pydantic and qdrant-client.
  • Renaming several test classes (e.g., from “Test…” to “Custom…” or “T…” prefixes) to prevent pytest from incorrectly treating non-test classes as tests.
  • Updating asynchronous calls and coroutine cancellation patterns and adding the langchain-community dependency as required.

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/aiq/utils/test_yaml_tools.py Renamed a config class to avoid unintended test discovery.
tests/aiq/retriever/test_retrievers.py Renamed Milvus client and corrected spelling for collection names; updated async calls for search methods.
tests/aiq/front_ends/fastapi/test_fastapi_front_end_plugin.py Renamed worker class to align with naming conventions.
tests/aiq/eval/test_evaluate.py Modified evaluation logic to check output mode and cancel asynchronous tasks on exception.
tests/aiq/builder/test_builder.py Renamed various provider and config classes to avoid pytest conflicts and updated warning expectations.
src/aiq/runtime/loader.py Adjusted entry point aggregation to correctly convert iterables to lists.
src/aiq/profiler/inference_optimization/llm_metrics.py Modified groupby processing for metrics calculation.
src/aiq/profiler/inference_optimization/data_models.py Switched from update_forward_refs to model_rebuild per updated Pydantic practices.
src/aiq/observability/async_otel_listener.py Added warnings filtering to silence known deprecation warnings.
src/aiq/eval/evaluate.py Added a pre-check for workflows with multiple outputs and improved coroutine cancellation in error handling.
src/aiq/cli/commands/start.py Changed the command group class type from click.MultiCommand to click.Group.
pyproject.toml Updated warning filters and adjusted asynchronous loop settings.
packages/aiqtoolkit_test/src/aiq/test/embedder.py Updated import for DeterministicFakeEmbedding to use langchain-community.
packages/aiqtoolkit_test/pyproject.toml Added dependency on langchain-community.
packages/aiqtoolkit_mem0ai/tests/test_mem0_editor.py Updated fixture type hint for the mocked memory client.
packages/aiqtoolkit_agno/tests/test_tool_wrapper.py Modified async call patterns to rely on provided event loops rather than run_coroutine_threadsafe.
examples/profiler_agent/src/aiq_profiler_agent/tool/flow_chart.py Removed the explicit edgecolor from the rectangle, likely affecting diagram styling.
.vale.ini Updated file extensions to include “.mdx” alongside “.md” and “.rst”.
Comments suppressed due to low confidence (2)

src/aiq/runtime/loader.py:135

  • The change from x + y to list(x) + list(y) ensures that the entrypoint iterables are properly converted to lists before concatenation. This avoids unexpected type errors if x and y aren't lists.
aiq_plugins = reduce(lambda x, y: list(x) + list(y), [entry_points.select(group=y) for y in plugin_groups])

tests/aiq/retriever/test_retrievers.py:242

  • The collection name spelling was corrected from 'collecion1' to 'collection1'. Verify that this change is consistent with the rest of the codebase.
milvus_retriever.bind(top_k=2, collection_name="collection1")

Signed-off-by: David Gardner <dagardner@nvidia.com>
…ove-warnings

Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
@dagardner-nv
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit d8ed65b into NVIDIA:develop May 27, 2025
12 checks passed
@dagardner-nv dagardner-nv deleted the david-remove-warnings branch May 27, 2025 23:34
gfreeman-nvidia pushed a commit to gfreeman-nvidia/AIQToolkit that referenced this pull request May 30, 2025
* `pytest` now runs without reporting any warnings on 3.12 (there is a warning 3.11 that pytest is unable to silence), down from 46.
* Update code to avoid several deprecation warnings (mostly Pydantic)
* Silence warnings being emitted by weave that we have no control over (wandb/weave#4533 & wandb/weave#3666)
* Add a dependency on `langchain-community` to `aiqtoolkit-test` needed for the `DeterministicFakeEmbedding` class (this is currently a transitory dep of ragas)
* Renamed test classes beginning with `Test` which were not test classes, to prevent pytest from attempting to run them.
* Avoid mocking the `asyncio.run_coroutine_threadsafe` method, this ensures that coroutines are awaited.
* Update `src/aiq/eval/evaluate.py` such that coroutines are only started after passing the `if not session_manager.workflow.has_single_output` check, and in the event of an exception, cancel any running coroutines in the exception handler.
* Ignore syntax warnings being emitted by [qdrant-client](https://github.com/qdrant/qdrant-client) used by mem0, remove once the fix for qdrant/qdrant-client#983 is released.

Closes NVIDIA#308

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/AIQToolkit/blob/develop/docs/source/resources/contributing.md).
- We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
  - Any contribution which contains commits that are not Signed-Off will not be accepted.
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Anuradha Karuppiah (https://github.com/AnuradhaKaruppiah)

URL: NVIDIA#305
Signed-off-by: Greg Freeman <gfreeman@nvidia.com>
ericevans-nv pushed a commit to ericevans-nv/agent-iq that referenced this pull request Jun 3, 2025
* `pytest` now runs without reporting any warnings on 3.12 (there is a warning 3.11 that pytest is unable to silence), down from 46.
* Update code to avoid several deprecation warnings (mostly Pydantic)
* Silence warnings being emitted by weave that we have no control over (wandb/weave#4533 & wandb/weave#3666)
* Add a dependency on `langchain-community` to `aiqtoolkit-test` needed for the `DeterministicFakeEmbedding` class (this is currently a transitory dep of ragas)
* Renamed test classes beginning with `Test` which were not test classes, to prevent pytest from attempting to run them.
* Avoid mocking the `asyncio.run_coroutine_threadsafe` method, this ensures that coroutines are awaited.
* Update `src/aiq/eval/evaluate.py` such that coroutines are only started after passing the `if not session_manager.workflow.has_single_output` check, and in the event of an exception, cancel any running coroutines in the exception handler.
* Ignore syntax warnings being emitted by [qdrant-client](https://github.com/qdrant/qdrant-client) used by mem0, remove once the fix for qdrant/qdrant-client#983 is released.

Closes NVIDIA#308

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/AIQToolkit/blob/develop/docs/source/resources/contributing.md).
- We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
  - Any contribution which contains commits that are not Signed-Off will not be accepted.
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Anuradha Karuppiah (https://github.com/AnuradhaKaruppiah)

URL: NVIDIA#305
Signed-off-by: Eric Evans <194135482+ericevans-nv@users.noreply.github.com>
ericevans-nv pushed a commit to ericevans-nv/agent-iq that referenced this pull request Jun 3, 2025
* `pytest` now runs without reporting any warnings on 3.12 (there is a warning 3.11 that pytest is unable to silence), down from 46.
* Update code to avoid several deprecation warnings (mostly Pydantic)
* Silence warnings being emitted by weave that we have no control over (wandb/weave#4533 & wandb/weave#3666)
* Add a dependency on `langchain-community` to `aiqtoolkit-test` needed for the `DeterministicFakeEmbedding` class (this is currently a transitory dep of ragas)
* Renamed test classes beginning with `Test` which were not test classes, to prevent pytest from attempting to run them.
* Avoid mocking the `asyncio.run_coroutine_threadsafe` method, this ensures that coroutines are awaited.
* Update `src/aiq/eval/evaluate.py` such that coroutines are only started after passing the `if not session_manager.workflow.has_single_output` check, and in the event of an exception, cancel any running coroutines in the exception handler.
* Ignore syntax warnings being emitted by [qdrant-client](https://github.com/qdrant/qdrant-client) used by mem0, remove once the fix for qdrant/qdrant-client#983 is released.

Closes NVIDIA#308

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/AIQToolkit/blob/develop/docs/source/resources/contributing.md).
- We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
  - Any contribution which contains commits that are not Signed-Off will not be accepted.
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Anuradha Karuppiah (https://github.com/AnuradhaKaruppiah)

URL: NVIDIA#305
Signed-off-by: Eric Evans <194135482+ericevans-nv@users.noreply.github.com>
ericevans-nv pushed a commit to ericevans-nv/agent-iq that referenced this pull request Jun 3, 2025
* `pytest` now runs without reporting any warnings on 3.12 (there is a warning 3.11 that pytest is unable to silence), down from 46.
* Update code to avoid several deprecation warnings (mostly Pydantic)
* Silence warnings being emitted by weave that we have no control over (wandb/weave#4533 & wandb/weave#3666)
* Add a dependency on `langchain-community` to `aiqtoolkit-test` needed for the `DeterministicFakeEmbedding` class (this is currently a transitory dep of ragas)
* Renamed test classes beginning with `Test` which were not test classes, to prevent pytest from attempting to run them.
* Avoid mocking the `asyncio.run_coroutine_threadsafe` method, this ensures that coroutines are awaited.
* Update `src/aiq/eval/evaluate.py` such that coroutines are only started after passing the `if not session_manager.workflow.has_single_output` check, and in the event of an exception, cancel any running coroutines in the exception handler.
* Ignore syntax warnings being emitted by [qdrant-client](https://github.com/qdrant/qdrant-client) used by mem0, remove once the fix for qdrant/qdrant-client#983 is released.

Closes NVIDIA#308

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/AIQToolkit/blob/develop/docs/source/resources/contributing.md).
- We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
  - Any contribution which contains commits that are not Signed-Off will not be accepted.
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Anuradha Karuppiah (https://github.com/AnuradhaKaruppiah)

URL: NVIDIA#305
Signed-off-by: Eric Evans <194135482+ericevans-nv@users.noreply.github.com>
AnuradhaKaruppiah pushed a commit to AnuradhaKaruppiah/oss-agentiq that referenced this pull request Aug 4, 2025
* `pytest` now runs without reporting any warnings on 3.12 (there is a warning 3.11 that pytest is unable to silence), down from 46.
* Update code to avoid several deprecation warnings (mostly Pydantic)
* Silence warnings being emitted by weave that we have no control over (wandb/weave#4533 & wandb/weave#3666)
* Add a dependency on `langchain-community` to `aiqtoolkit-test` needed for the `DeterministicFakeEmbedding` class (this is currently a transitory dep of ragas) 
* Renamed test classes beginning with `Test` which were not test classes, to prevent pytest from attempting to run them.
* Avoid mocking the `asyncio.run_coroutine_threadsafe` method, this ensures that coroutines are awaited.
* Update `src/aiq/eval/evaluate.py` such that coroutines are only started after passing the `if not session_manager.workflow.has_single_output` check, and in the event of an exception, cancel any running coroutines in the exception handler.
* Ignore syntax warnings being emitted by [qdrant-client](https://github.com/qdrant/qdrant-client) used by mem0, remove once the fix for qdrant/qdrant-client#983 is released.

Closes NVIDIA#308

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/AIQToolkit/blob/develop/docs/source/resources/contributing.md).
- We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
  - Any contribution which contains commits that are not Signed-Off will not be accepted.
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Anuradha Karuppiah (https://github.com/AnuradhaKaruppiah)

URL: NVIDIA#305
scheckerNV pushed a commit to scheckerNV/aiq-factory-reset that referenced this pull request Aug 22, 2025
* `pytest` now runs without reporting any warnings on 3.12 (there is a warning 3.11 that pytest is unable to silence), down from 46.
* Update code to avoid several deprecation warnings (mostly Pydantic)
* Silence warnings being emitted by weave that we have no control over (wandb/weave#4533 & wandb/weave#3666)
* Add a dependency on `langchain-community` to `aiqtoolkit-test` needed for the `DeterministicFakeEmbedding` class (this is currently a transitory dep of ragas) 
* Renamed test classes beginning with `Test` which were not test classes, to prevent pytest from attempting to run them.
* Avoid mocking the `asyncio.run_coroutine_threadsafe` method, this ensures that coroutines are awaited.
* Update `src/aiq/eval/evaluate.py` such that coroutines are only started after passing the `if not session_manager.workflow.has_single_output` check, and in the event of an exception, cancel any running coroutines in the exception handler.
* Ignore syntax warnings being emitted by [qdrant-client](https://github.com/qdrant/qdrant-client) used by mem0, remove once the fix for qdrant/qdrant-client#983 is released.

Closes NVIDIA#308

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/AIQToolkit/blob/develop/docs/source/resources/contributing.md).
- We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
  - Any contribution which contains commits that are not Signed-Off will not be accepted.
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Anuradha Karuppiah (https://github.com/AnuradhaKaruppiah)

URL: NVIDIA#305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: coroutines not being awaited in tests

2 participants