File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -187,12 +187,14 @@ class CLIBase(object):
187
187
# child classes will need to set these values in order to use the class
188
188
app_cls = None
189
189
cmd_name = None
190
+ force_app_context_cleanup = False
190
191
191
192
@classmethod
192
193
def setup_class (cls ):
193
194
# If a current app context is set, it may complicate what click is doing to
194
195
# set up and run a specific app.
195
- cleanup_app_contexts ()
196
+ if cls .app_cls or cls .force_app_context_cleanup :
197
+ cleanup_app_contexts ()
196
198
197
199
cls .runner = click .testing .CliRunner ()
198
200
Original file line number Diff line number Diff line change @@ -82,6 +82,9 @@ def test_default_exception_handling(self):
82
82
83
83
84
84
class TestCLI2 (CLIBase ):
85
+ # We don't set an app_cls (see below), but we do want any current app context cleaned
86
+ # up before constructing a new one.
87
+ force_app_context_cleanup = True
85
88
86
89
@classmethod
87
90
def setup_class (cls ):
You can’t perform that action at this time.
0 commit comments