modify_settings
Like override_settings, but makes it possible to append, prepend, or remove items instead of redefining the entire list.
Attributes
| Attribute | Type | Description |
|---|---|---|
| operations | list | A list of tuples containing setting names and their corresponding transformation dictionaries (append, prepend, or remove) to be applied to the configuration. |
| options | dict | A dictionary mapping setting names to their newly calculated values after all append, prepend, and remove operations have been processed. |
Constructor
Signature
def modify_settings(
*args: tuple,
**kwargs: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| *args | tuple | Positional arguments, used primarily when instantiated from test case setup classes to pass a pre-defined list of operations. |
| **kwargs | dict | Keyword arguments where the key is the setting name and the value is a dictionary defining the modification actions. |
Methods
save_options()
@classmethod
def save_options(
test_func: callable
)
Stores or appends the requested setting operations onto the test function's internal tracking attribute to ensure modifications are preserved across test execution.
Parameters
| Name | Type | Description |
|---|---|---|
| test_func | callable | The test function or method instance where the modified settings operations are being recorded. |
enable()
@classmethod
def enable()
Applies the configured setting modifications by performing append, prepend, or remove operations on the current Django settings values.