Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Sep 19, 2024
1 parent 834d957 commit 0148f36
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/functional/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_info_level_higher(simple_runner):
def cmd(cli_ctx):
cli_ctx.logger.info("this is a test")

logger._did_parse_sys_argv = False
result = simple_runner.invoke(group_for_testing, ("cmd", "-v", "WARNING"))

# You don't get INFO log when log level is higher
Expand All @@ -57,6 +58,7 @@ def test_warning_level_higher(simple_runner):
def cmd(cli_ctx):
cli_ctx.logger.warning("this is a test")

logger._did_parse_sys_argv = False
result = simple_runner.invoke(group_for_testing, ("cmd", "-v", "ERROR"))
assert "WARNING" not in result.output
assert "this is a test" not in result.output
Expand All @@ -71,6 +73,7 @@ def test_success(simple_runner):
def cmd(cli_ctx):
cli_ctx.logger.success("this is a test")

logger._did_parse_sys_argv = False
result = simple_runner.invoke(group_for_testing, "cmd")
assert "SUCCESS" in result.output
assert "this is a test" in result.output
Expand All @@ -82,6 +85,7 @@ def test_success_level_higher(simple_runner):
def cmd(cli_ctx):
cli_ctx.logger.success("this is a test")

logger._did_parse_sys_argv = False
result = simple_runner.invoke(group_for_testing, ("cmd", "-v", "WARNING"))
assert "SUCCESS" not in result.output
assert "this is a test" not in result.output
Expand All @@ -97,6 +101,7 @@ def cmd(cli_ctx):
finally:
cli_ctx.logger.format()

logger._did_parse_sys_argv = False
result = simple_runner.invoke(group_for_testing, ("cmd", "-v", "SUCCESS"))
assert "SUCCESS" not in result.output

Expand Down

0 comments on commit 0148f36

Please sign in to comment.