Skip to content

Commit

Permalink
chore: Add indentation & section name to the SUMMARY CLI block.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stranger6667 committed Apr 22, 2020
1 parent 3b04f09 commit c00ce36
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.rst
Expand Up @@ -6,6 +6,11 @@ Changelog
`Unreleased`_
-------------

Changed
~~~~~~~

- Added indentation & section name to the ``SUMMARY`` CLI block.

`1.2.0`_ - 2020-04-15
---------------------

Expand Down
4 changes: 3 additions & 1 deletion src/schemathesis/cli/output/default.py
Expand Up @@ -230,7 +230,9 @@ def display_statistic(event: events.Finished) -> None:
col2_len = len(str(max(total.values(), key=lambda v: v["total"])["total"])) * 2 + padding
col3_len = padding

template = f"{{:{col1_len}}}{{:{col2_len}}}{{:{col3_len}}}"
click.echo("Performed checks:")

template = f" {{:{col1_len}}}{{:{col2_len}}}{{:{col3_len}}}"

for check_name, results in total.items():
display_check_result(check_name, results, template)
Expand Down
6 changes: 3 additions & 3 deletions test/cli/output/test_default.py
Expand Up @@ -102,9 +102,9 @@ def test_display_statistic(capsys, swagger_20, endpoint):
different_check = strip_style_win32(click.style("different_check", bold=True))
passed = strip_style_win32(click.style("PASSED", bold=True, fg="green"))
# Then all check results should be properly displayed with relevant colors
assert lines[1:3] == [
f"{not_a_server_error} 3 / 5 passed {failed} ",
f"{different_check} 1 / 1 passed {passed} ",
assert lines[2:4] == [
f" {not_a_server_error} 3 / 5 passed {failed} ",
f" {different_check} 1 / 1 passed {passed} ",
]


Expand Down
5 changes: 3 additions & 2 deletions test/cli/test_commands.py
Expand Up @@ -392,7 +392,8 @@ def test_cli_run_output_with_errors(cli, cli_args, workers):

lines = result.stdout.strip().split("\n")
assert "1. Received a response with 5xx status code: 500" in lines
assert "not_a_server_error 1 / 3 passed FAILED " in lines
assert "Performed checks:" in lines
assert " not_a_server_error 1 / 3 passed FAILED " in lines
assert f"== 1 passed, 1 failed in " in lines[-1]


Expand All @@ -405,7 +406,7 @@ def test_cli_run_only_failure(cli, cli_args, workers):
assert " SUMMARY " in result.stdout

lines = result.stdout.strip().split("\n")
assert "not_a_server_error 0 / 2 passed FAILED " in lines
assert " not_a_server_error 0 / 2 passed FAILED " in lines
assert "== 1 failed in " in lines[-1]


Expand Down

0 comments on commit c00ce36

Please sign in to comment.