Skip to content

Further warning exclusion cleanup and test improvements#10693

Merged
max-sixty merged 7 commits into
pydata:mainfrom
max-sixty:warnings-cleanup-2
Sep 3, 2025
Merged

Further warning exclusion cleanup and test improvements#10693
max-sixty merged 7 commits into
pydata:mainfrom
max-sixty:warnings-cleanup-2

Conversation

@max-sixty
Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #10690 with additional warning exclusion cleanup and test improvements.

Changes

1. Removed 3 more obsolete warning exclusions

  • "default:No index created:UserWarning:xarray.core.dataset" - Tests properly handle with pytest.warns()
  • "default:the pandas.MultiIndex object:FutureWarning:xarray.tests.test_variable" - No longer triggered
  • "default:Duplicate dimension names present:UserWarning:xarray.namedarray.core" - Tests handle with local @pytest.mark.filterwarnings

2. Fixed quantile interpolation deprecation test handling

  • Made test_dataset.py use pytest.warns() consistently instead of warnings.catch_warnings()
  • Added @pytest.mark.filterwarnings decorators to all 4 deprecation test functions to locally allow the warning
  • This removes the need for a global exclusion while still properly testing our deprecation

3. Total impact

  • 17 warning exclusions removed across both PRs
  • Tests now handle warnings more explicitly with local decorators
  • Cleaner and more maintainable warning configuration

Test plan

  • All modified tests pass locally
  • No new warnings introduced
  • CI should pass

🤖 Generated with Claude Code

max-sixty and others added 7 commits September 3, 2025 15:08
Removed 11 warning exclusions that are no longer needed:
- Invalid cast warnings from duck_array_ops and test_array_api
- CachingFileManager deallocation warnings from backends
- Deprecated treenode methods (ancestors, iter_lineage, lineage)
- Test-specific deprecations that no longer exist

These exclusions were verified to be safe to remove through testing.
The test suite passes with 20,779 tests after removal.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Removed 3 more warning exclusions that are no longer needed:
- UserWarning from test_coding_times
- UserWarning from test_computation
- UserWarning from test_dataset

All test files pass without these warning exclusions.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Removed warning exclusions that are no longer needed:
- "No index created" UserWarning - Tests properly handle with pytest.warns
- "pandas.MultiIndex" FutureWarning - No longer triggered
- "Duplicate dimension names" UserWarning - Tests handle with local filterwarnings

These warnings are either properly tested or no longer occur.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed test_dataset.py to use pytest.warns instead of warnings.catch_warnings
for testing the interpolation->method deprecation warning. This makes it
consistent with the other test files.

Note: We cannot remove the global warning exclusion because the error:::xarray.*
rule converts warnings to errors before pytest.warns can catch them. This is
a known limitation of the current filterwarnings configuration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Instead of relying on a global warning exclusion, added
@pytest.mark.filterwarnings decorators to the specific tests that
test the interpolation->method deprecation warning. This allows
the warning to be properly tested while avoiding the conflict
with the error:::xarray.* rule.

Now the global exclusion for this warning can be safely removed.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty max-sixty merged commit 0b0791b into pydata:main Sep 3, 2025
37 checks passed
@max-sixty max-sixty deleted the warnings-cleanup-2 branch September 3, 2025 23:50
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.

1 participant