FIX: Support 5.1-Resolved Circular Import Issue In Testapp #453
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.
This pull request introduces support for testing Django 5.1 across multiple Python versions in the CI pipeline and resolves potential circular import issues in the test suite by adjusting import order and references to database operations. Below are the key changes:
Test Suite Improvements:
test_multiple_databases.py
to importBaseDatabaseOperations
beforesqlite3.operations.DatabaseOperations
, preventing potential circular import issues and ensuring the base class is available for subclassing.test_in_split_parameter_list_as_sql
to referenceBaseDatabaseOperations.max_in_list_size
instead ofDatabaseOperations.max_in_list_size
, aligning with the updated import order and improving clarity.Prefer Modifying BaseDatabaseOperations Over connections[].ops for Cleaner and Backend-Agnostic Test Behavior
connections['default'].ops
and modifyingthe instance-level method, I switched to modifying the class method on
BaseDatabaseOperations
.Though both approaches technically work, directly using
BaseDatabaseOperations
is more efficient and maintainable:This approach also aligns better with Django's extensibility model, where backend-specific behavior typically extends
BaseDatabaseOperations
.Doc Link: Circular Import-support 5.1.loop
ADO Link: https://sqlclientdrivers.visualstudio.com/mssql-django/_workitems/edit/37633