-
Notifications
You must be signed in to change notification settings - Fork 20
Engine Disposal #33
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
Engine Disposal #33
Conversation
- Updated the Comparer class to include a `dispose_engines` flag for automatic disposal of database engines after comparison. - Modified the `from_params` classmethod to set this flag to true by default. - Added a `dispose` method to close pooled connections. - Updated README.md to reflect these changes and provide usage notes. - Introduced tests to verify engine disposal behavior.
tests/test_comparer.py
Outdated
| engine_one.dispose.assert_called_once_with() | ||
| engine_two.dispose.assert_called_once_with() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could both be assert_called_once()
https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.assert_called_once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both fixed (there was another pair in another test), thank you for spotting it
- Updated assertions in `test_comparer.py` to use `assert_called_once()` instead of `assert_called_once_with()` for better clarity and consistency in testing engine calls.
mmcardle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
- Changed the private attribute for engine disposal from `_dispose_engines` to `__dispose_engines` for better encapsulation. - Updated the disposal logic in the `finally` block to call the renamed `_dispose_engines` method, ensuring proper closure of pooled connections.
- Updated the `db_engine_one` and `db_engine_two` fixtures in `base.py` to use a context manager for engine disposal, ensuring that resources are properly released after use. - Modified the `sqlite_db_engine_one` and `sqlite_db_engine_two` fixtures in `test_comparer.py` similarly to enhance resource management during tests.
|
@mmcardle final tidy up pushed up :) |
mmcardle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM still👍
Thank you man |
@mmcardle
This is a fix in response to #32.
It: