chore(tests): Remove unnecessary explicit Flask-SQLAlchemy session expunges#27136
Merged
john-bodley merged 1 commit intoFeb 16, 2024
Merged
Conversation
john-bodley
commented
Feb 16, 2024
| def get_slice(self, slice_name: str, expunge_from_session: bool = True) -> Slice: | ||
| slc = db.session.query(Slice).filter_by(slice_name=slice_name).one() | ||
| if expunge_from_session: | ||
| db.session.expunge_all() |
Member
Author
There was a problem hiding this comment.
It seems weird that we were expunging all objects from the session and not just the chart in question.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #27136 +/- ##
==========================================
- Coverage 67.15% 67.15% -0.01%
==========================================
Files 1902 1902
Lines 74453 74453
Branches 8306 8306
==========================================
- Hits 49998 49997 -1
- Misses 22401 22402 +1
Partials 2054 2054
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
grvoicu
added a commit
to grvoicu/superset
that referenced
this pull request
Feb 20, 2024
…-to-the-embedded-dashboard * master: (1182 commits) fix(ci): mypy pre-commit issues (apache#27161) feat(Alerts and Reports): Modal redesign (apache#26202) refactor: Migrate ErrorBoundary to typescript (apache#27143) chore(tests): Remove unnecessary explicit Flask-SQLAlchemy session expunges (apache#27136) fix(plugins): Apply dashboard filters to comparison query in BigNumber with Time Comparison chart (apache#27138) fix: Duplicated toast messages (apache#27135) docs: add Geotab to users list (apache#27134) fix: Plain error message when visiting a dashboard via permalink without permissions (apache#27132) fix: ID param for DELETE ssh_tunnel endpoint (apache#27130) chore(hail mary): Update package-lock.json via npm-audit-fix (apache#26693) chore: lower cryptography min version to 41.0.2 (apache#27129) docs(miscellaneous): Export Datasoruces: export datasources exports to ZIP (apache#27120) fix(pivot-table-v2): Added forgotten translation pivot table v2 (apache#22840) fix: RLS modal overflow (apache#27128) refactor: Updates some database columns to MediumText (apache#27119) fix: gevent upgrade to 23.9.1 (apache#27112) fix: removes old deprecated sqllab endpoints (apache#27117) feat(storybook): Co-habitating/Upgrading Storybooks to v7 (dependency madness ensues) (apache#26907) fix: bump grpcio, urllib3 and paramiko (apache#27124) chore(internet_port): added new ports and removed unnecessary string class (apache#27078) ...
vinothkumar66
pushed a commit
to vinothkumar66/superset
that referenced
this pull request
Nov 11, 2024
qfcwell
pushed a commit
to qfcwell/superset
that referenced
this pull request
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
There's a few instances within our tests where we explicitly expunge either specific or all objects from the session, however this is unnecessary as the Flask-SQLAlchemy session is torn down after each test (verified via logging) in which the current session is removed/closed and thus there's no need to explicitly expunge the records.
Note this change is a precursor to defining a "unit of work" as part of SIP-99B. I've been struggling to get the various unit/integration tests to pass in my PoC—in part due to atypical testing patterns.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
CI.
ADDITIONAL INFORMATION