Skip to content

Conversation

@gianchub
Copy link
Owner

@mmcardle

This is a fix in response to #32.

It:

  • Adds the ability to dispose an engine, which closes the connection pool currently used and creates a new one immediately. (See here)
  • Adds tests for new functionality.
  • Updates the README
  • Updates scaffolding, versions, requirements, etc.

- 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.
Comment on lines 182 to 183
engine_one.dispose.assert_called_once_with()
engine_two.dispose.assert_called_once_with()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Owner Author

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.
@gianchub gianchub requested a review from mmcardle December 13, 2025 14:32
mmcardle
mmcardle previously approved these changes Dec 13, 2025
Copy link
Collaborator

@mmcardle mmcardle left a 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.
@gianchub
Copy link
Owner Author

gianchub commented Dec 13, 2025

@mmcardle final tidy up pushed up :)

Copy link
Collaborator

@mmcardle mmcardle left a comment

Choose a reason for hiding this comment

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

LGTM still👍

@gianchub
Copy link
Owner Author

LGTM still👍

Thank you man

@gianchub gianchub merged commit 1e349f5 into main Dec 13, 2025
14 checks passed
@gianchub gianchub deleted the engine-fix branch December 13, 2025 15:06
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.

3 participants