Skip to content

Commit

Permalink
fix break in CLI test context usage
Browse files Browse the repository at this point in the history
  • Loading branch information
guruofgentoo committed Nov 3, 2022
1 parent de8b450 commit b035e7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion keg/testing.py
Expand Up @@ -187,12 +187,14 @@ class CLIBase(object):
# child classes will need to set these values in order to use the class
app_cls = None
cmd_name = None
force_app_context_cleanup = False

@classmethod
def setup_class(cls):
# If a current app context is set, it may complicate what click is doing to
# set up and run a specific app.
cleanup_app_contexts()
if cls.app_cls or cls.force_app_context_cleanup:
cleanup_app_contexts()

cls.runner = click.testing.CliRunner()

Expand Down
3 changes: 3 additions & 0 deletions keg/tests/test_cli.py
Expand Up @@ -82,6 +82,9 @@ def test_default_exception_handling(self):


class TestCLI2(CLIBase):
# We don't set an app_cls (see below), but we do want any current app context cleaned
# up before constructing a new one.
force_app_context_cleanup = True

@classmethod
def setup_class(cls):
Expand Down

0 comments on commit b035e7c

Please sign in to comment.