The existing pattern of using `override_settings(MODULESTORE=...)` prevented us from having more than one layer of subclassing in modulestore tests. In a structure like: @override_settings(MODULESTORE=store_a) class BaseTestCase(ModuleStoreTestCase): def setUp(self): # use store @override_settings(MODULESTORE=store_b) class ChildTestCase(BaseTestCase): def setUp(self): # use store In this case, the store actions performed in `BaseTestCase` on behalf of `ChildTestCase` would still use `store_a`, even though the `ChildTestCase` had specified to use `store_b`. This is because the `override_settings` decorator would be the innermost wrapper around the `BaseTestCase.setUp` method, no matter what `ChildTestCase` does. To remedy this, we move the call to `override_settings` into the `ModuleStoreTestCase.setUp` method, and use a cleanup to remove the override. Subclasses can just defined the `MODULESTORE` class attribute to specify which modulestore to use _for the entire `setUp` chain_. [PLAT-419]
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
cache_toolbox | Loading commit data... | |
config_models | Loading commit data... | |
contentserver | Loading commit data... | |
course_about | Loading commit data... | |
course_action_state | Loading commit data... | |
course_modes | Loading commit data... | |
dark_lang | Loading commit data... | |
datadog | Loading commit data... | |
django_comment_common | Loading commit data... | |
django_future | Loading commit data... | |
edxmako | Loading commit data... | |
embargo | Loading commit data... | |
enrollment | Loading commit data... | |
external_auth | Loading commit data... | |
geoinfo | Loading commit data... | |
heartbeat | Loading commit data... | |
lang_pref | Loading commit data... | |
microsite_configuration | Loading commit data... | |
monitoring | Loading commit data... | |
monkey_patch | Loading commit data... | |
pipeline_js | Loading commit data... | |
pipeline_mako | Loading commit data... | |
request_cache | Loading commit data... | |
reverification | Loading commit data... | |
service_status | Loading commit data... | |
session_inactivity_timeout | Loading commit data... | |
static_replace | Loading commit data... | |
status | Loading commit data... | |
student | Loading commit data... | |
terrain | Loading commit data... | |
third_party_auth | Loading commit data... | |
track | Loading commit data... | |
util | Loading commit data... | |
xblock_django | Loading commit data... | |
xmodule_django | Loading commit data... | |
xmodule_modifiers.py | Loading commit data... |