Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More realistic MockSessionMaker #2104

Merged
merged 2 commits into from
Oct 5, 2024

Conversation

jonathangreen
Copy link
Member

Description

Updates the behavior of MockSessionMaker.__call__ to more accurately reflect what a real session maker object does.

Motivation and Context

Within a Celery task if you do:

with task.session() as session:
   ...

It will automatically open and close the session for you, but you are on your own to remember to commit if you need to. Previously this data was still available after the fixture ran, so it looked to tests like it was committed. However now it won't be unless its explicitly committed, which is more accurate and should help catch mistakes.

How Has This Been Tested?

  • Tested in CI

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

Copy link

codecov bot commented Oct 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.65%. Comparing base (e54575f) to head (819da61).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2104   +/-   ##
=======================================
  Coverage   90.65%   90.65%           
=======================================
  Files         344      344           
  Lines       40581    40581           
  Branches     8822     8822           
=======================================
  Hits        36790    36790           
  Misses       2484     2484           
  Partials     1307     1307           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jonathangreen jonathangreen requested a review from a team October 5, 2024 02:23
Copy link
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟰

@jonathangreen jonathangreen merged commit 35ac813 into main Oct 5, 2024
20 checks passed
@jonathangreen jonathangreen deleted the bugfix/more-realistic-mock-session branch October 5, 2024 17:12
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.

2 participants