File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,23 @@ def tearDownClass(cls):
111
111
112
112
113
113
def cleanup (style = None ):
114
+ """
115
+ A decorator to ensure that any global state is reset before
116
+ running a test.
117
+
118
+ Parameters
119
+ ----------
120
+ style : str, optional
121
+ The name of the style to apply.
122
+ """
123
+
124
+ # If cleanup is used without arguments, `style` will be a
125
+ # callable, and we pass it directly to the wrapper generator. If
126
+ # cleanup if called with an argument, it is a string naming a
127
+ # style, and the function will be passed as an argument to what we
128
+ # return. This is a confusing, but somewhat standard, pattern for
129
+ # writing a decorator with optional arguments.
130
+
114
131
def make_cleanup (func ):
115
132
@functools .wraps (func )
116
133
def wrapped_function (* args , ** kwargs ):
You can’t perform that action at this time.
0 commit comments