Skip to content

fix: Fix pytest warning filters#990

Merged
ajcasagrande merged 1 commit into
mainfrom
ajc/craplog
May 23, 2026
Merged

fix: Fix pytest warning filters#990
ajcasagrande merged 1 commit into
mainfrom
ajc/craplog

Conversation

@ajcasagrande

@ajcasagrande ajcasagrande commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Avoid importing the optional BoTorch warning category during pytest startup
  • Make the flat-shape migration warning test resilient to unrelated caplog records

Test plan

  • uv run pytest -n auto tests/unit/config/test_envelope_restructure.py -q

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Updated internal warning filter configuration for improved warning management consistency.
  • Tests

    • Enhanced test coverage with improved log message filtering and assertion logic for migration validation tests.

Review Change Stack

Avoid importing optional BoTorch warning classes during pytest startup and make the flat-shape deprecation assertion resilient to unrelated caplog records.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Anthony Casagrande <acasagrande@nvidia.com>
@github-actions

Copy link
Copy Markdown

Try out this PR

Quick install:

pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@0cd75755aaa529bfcf1bdf5154fa064978ab75cd

Recommended with virtual environment (using uv):

uv venv --python 3.12 && source .venv/bin/activate
uv pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@0cd75755aaa529bfcf1bdf5154fa064978ab75cd

Last updated for commit: 0cd7575Browse code

@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR improves test stability by broadening the pytest warning filter for torch.float32 messages and refining test caplog filtering to tolerate unrelated warnings. The test now filters log records more precisely and asserts on matching records rather than relying on a fixed record position.

Changes

Test stability and warning handling

Layer / File(s) Summary
Pytest warning filter broadening
pyproject.toml
The pytest filterwarnings configuration is updated to ignore The model inputs are of type torch.float32.* messages regardless of warning category, removing the previous constraint to botorch.exceptions.warnings.InputDataWarning.
Test robustness improvements
tests/unit/config/test_envelope_restructure.py
Test adds a logging import and emits an unrelated warning to verify robustness. The caplog assertion is refined to filter records matching both "flat shape" and "migrate_config_yaml.py", replacing the prior single-record substring check with a filtered collection assertion.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Warnings wild and logs run deep,
We filter out the chaff we reap,
Our tests stand tall through noise and haste,
No more flakes—just steady taste!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: fixing pytest warning filters by broadening an ignore rule and updating test assertions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented May 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ajcasagrande ajcasagrande changed the title Fix pytest warning filters May 23, 2026
@github-actions github-actions Bot added the fix label May 23, 2026
@ajcasagrande ajcasagrande merged commit ae47282 into main May 23, 2026
25 of 27 checks passed
@ajcasagrande ajcasagrande deleted the ajc/craplog branch May 23, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants