- in the current implementation only "models" works as app_label
- there is no way to change that during run time as it's hard coded
- the fix introduces another _APP_LABEL global variable that is set
in the initializer
Enables testing of apps with other labels than "models" in test classes of tortoise/contrib/test
automagically from the TORTOISE_ORM config dict.
Description
Following the design of the file, a new global variable is introduced that is defined during the
call of the initializer function. Later occurences of the app_label function parameter in _setUpDB
member functions, that don't expose the app_label variable, are provided with _APP_LABEL as
default value.
Motivation and Context
App labels other than 'models' were not correctly propagated to the test functions, as 'models'
was hardcoded as app_label in the _setUpDB member functions.
How Has This Been Tested?
Existing tests of the package pass.
Checklist:
[x] My code follows the code style of this project.
[ ] My change requires a change to the documentation.
Enables testing of apps with other labels than "models" in test classes of tortoise/contrib/test automagically from the TORTOISE_ORM config dict.
Description
Following the design of the file, a new global variable is introduced that is defined during the call of the initializer function. Later occurences of the app_label function parameter in _setUpDB member functions, that don't expose the app_label variable, are provided with _APP_LABEL as default value.
Motivation and Context
App labels other than 'models' were not correctly propagated to the test functions, as 'models' was hardcoded as app_label in the _setUpDB member functions.
How Has This Been Tested?
Existing tests of the package pass.
Checklist: