FIX: Optimizing test run time without impacting coverage #380
+258
−552
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.
Work Item / Issue Reference
Summary
This pull request refactors and optimizes the
tests/test_013_SqlHandle_free_shutdown.pytest suite to improve test execution speed and maintainability. The main changes include reducing iteration counts and timeouts for faster test runs, and consolidating several similar tests into a single parameterized test usingpytest.mark.parametrize. This makes the tests more efficient and easier to manage.Test performance improvements:
Test suite maintainability:
_cleanup_connections()into a single parameterized test usingpytest.mark.parametrize, reducing code duplication and improving readability. The scenarios now covered are: normal flow, already closed connections, missing_closedattribute, exception handling, multiple connections, and WeakSet behavior. [1] [2] [3] [4] [5] [6]Test framework modernization:
pytestimport and usage to support parameterized testing.Test output and assertion updates:
These changes make the test suite faster, more robust, and easier to extend in the future.