ci: enforce SQLAlchemy 2.0 deprecation warnings in unit-test CI - #41915
Conversation
Part of the SQLAlchemy 2.0 migration battleplan (#40273). pytest.ini's filterwarnings already promotes several SQLAlchemy 2.0 deprecation-warning categories from a bare warning to a hard error, as each gets fixed and locked in — but SQLALCHEMY_WARN_20 was never actually set anywhere in CI, so those RemovedIn20Warning categories never actually fire during a normal test run and the enforcement was a no-op. A regression on any already-"fixed" category would pass CI silently. Set SQLALCHEMY_WARN_20=1 for the unit-tests job so the categories already promoted to error in pytest.ini are actually exercised on every PR and push, closing that gap. Verified locally by running the exact CI command (`pytest --durations-min=0.5 --cov-report= --cov=superset ./tests/common ./tests/unit_tests --cache-clear --maxfail=50`) with SQLALCHEMY_WARN_20=1 against master's current pytest.ini (3 promoted categories): only 2 pre-existing, unrelated date-boundary-sensitive flaky tests fail (test_get_time_filter, test_previous_calendar_quarter), both of which reproduce identically with no env vars set at all. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Bito Automatic Review Skipped - Files Excluded |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41915 +/- ##
==========================================
- Coverage 64.57% 64.56% -0.02%
==========================================
Files 2713 2718 +5
Lines 151269 151491 +222
Branches 34793 34802 +9
==========================================
+ Hits 97684 97808 +124
- Misses 51760 51854 +94
- Partials 1825 1829 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I think this would be great to catch regression in the migration. |
|
@hy144328 thanks for the numbers. CI ran green here so the volume did not seem to overwhelm anything, and |
|
LGTM. Let's do this! |
@rusackas Sorry for the late reply. I have been noticing errors locally here and there that did not show up in the CI. |
|
I actually opened a revert PR for that dependency today, but I'm considering removing support for python 3.10 instead. That might be more forward leaning, but I want to get more consensus. |
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
SUMMARY
Part of the SQLAlchemy 2.0 migration battleplan: #40273
pytest.ini'sfilterwarningsalready promotes several SQLAlchemy 2.0 deprecation-warning categories from a bare warning to a hard error, as each gets fixed and locked in (see #41914 for 3 more). ButSQLALCHEMY_WARN_20was never actually set anywhere in CI — grepped the whole repo, it only appears in a comment inpytest.ini. That means thoseRemovedIn20Warningcategories never actually fire during a normal CI run, so the "enforcement" was a no-op: a regression on any already-"fixed" category would pass CI silently, and a contributor would only catch it if they remembered to set the env var locally.This sets
SQLALCHEMY_WARN_20: "1"on theunit-testsjob so the categories already promoted toerror:inpytest.iniare actually exercised on every PR and push.TESTING INSTRUCTIONS
Ran the exact CI command locally against master's current
pytest.ini(3 promoted categories):Only 2 pre-existing, unrelated flaky tests fail (
test_get_time_filter×6,test_previous_calendar_quarter), and both reproduce identically with no env vars set at all — confirmed unrelated to this change (date-boundary-sensitive).ADDITIONAL INFORMATION