Commit 67dafd55 authored by Nikos Skalkotos's avatar Nikos Skalkotos

snf_django: Explain why @with_settings needs wraps

Add comment about why the use of functools.wraps is mandatory for the
decorators that are used in test functions.
parent e54d3f1e
......@@ -124,6 +124,9 @@ def override_settings(settings, **kwargs):
def with_settings(settings, prefix='', **override):
def wrapper(func):
# The use of wraps is required here. Without it, the name of a "test_"
# function that gets decorated by "with_settings" would become "inner"
# and nose would not detect it as a test function.
@functools.wraps(func)
def inner(*args, **kwargs):
with override_settings(settings, prefix=prefix, **override):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment