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 |
|---|---|---|
| .. | ||
| __init__.py | Loading commit data... | |
| test_clone_course.py | Loading commit data... | |
| test_contentstore.py | Loading commit data... | |
| test_core_caching.py | Loading commit data... | |
| test_course_create_rerun.py | Loading commit data... | |
| test_course_listing.py | Loading commit data... | |
| test_course_settings.py | Loading commit data... | |
| test_crud.py | Loading commit data... | |
| test_export_git.py | Loading commit data... | |
| test_i18n.py | Loading commit data... | |
| test_import.py | Loading commit data... | |
| test_import_draft_order.py | Loading commit data... | |
| test_import_pure_xblock.py | Loading commit data... | |
| test_libraries.py | Loading commit data... | |
| test_orphan.py | Loading commit data... | |
| test_permissions.py | Loading commit data... | |
| test_request_event.py | Loading commit data... | |
| test_transcripts_utils.py | Loading commit data... | |
| test_users_default_role.py | Loading commit data... | |
| test_utils.py | Loading commit data... | |
| tests.py | Loading commit data... | |
| utils.py | Loading commit data... |