Skip to main content

modify_settings

Like override_settings, but makes it possible to append, prepend, or remove items instead of redefining the entire list.

Attributes

AttributeTypeDescription
operationslistA list of tuples containing setting names and their corresponding transformation dictionaries (append, prepend, or remove) to be applied to the configuration.
optionsdictA 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

NameTypeDescription
*argstuplePositional arguments, used primarily when instantiated from test case setup classes to pass a pre-defined list of operations.
**kwargsdictKeyword 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

NameTypeDescription
test_funccallableThe 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.