Support multiple apps in testing initializer#1895
Open
primal100 wants to merge 2 commits intotortoise:developfrom
Open
Support multiple apps in testing initializer#1895primal100 wants to merge 2 commits intotortoise:developfrom
primal100 wants to merge 2 commits intotortoise:developfrom
Conversation
added 2 commits
February 25, 2025 11:36
…ts in testing initializer
CodSpeed Performance ReportMerging #1895 will not alter performanceComparing Summary
|
Author
|
Some checks are failing due to However, this newer way of writing Union types was introduced in Python 3.10 and tortoise-orm still allows support for 3.9, so that's why I still used typing.Union. |
Contributor
With this line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Allows the intializer to accept a mapping of app names to module list, allowing more flexibility when testing, and allowing tests to run on models across multiple apps. This would also allow models to work where they have a foreign key to a model in another app. The previous modules list and app label still works as normal so compatibility will not be affected. If a dict of app names to modules is provided, the app_label kw argument is not used.
Motivation and Context
Particularly useful when integrating models from a third party library into your own application.
Issue created a while back: #1521
How Has This Been Tested?
This is something that needs to be discussed as at the moment intializer and finalizer is run as an autouse session fixture, so difficult to override for a single test. Coverage is not an issue as there are no new lines.
Possibilities include:
initialize_testsfixture to use the new apps/module dict format in which case the older single list format would not be tested.Checklist: