Support multiple apps in testing initializer #1895
Open
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_tests
fixture to use the new apps/module dict format in which case the older single list format would not be tested.Checklist: