How to use the schemathesis.cli.output.default.get_terminal_width function in schemathesis

To help you get started, we’ve selected a few schemathesis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kiwicom / schemathesis / test / cli / output / test_default.py View on Github external
def test_display_section_name(capsys, title, separator, printed, expected):
    # When section name is displayed
    default.display_section_name(title, separator=separator)
    out = capsys.readouterr().out.strip()
    terminal_width = default.get_terminal_width()
    # It should fit into the terminal width
    assert len(click.unstyle(out)) == terminal_width
    # And the section name should be bold
    assert click.style(click.unstyle(out), bold=True) == out
    assert expected in out
github kiwicom / schemathesis / test / cli / output / test_default.py View on Github external
def test_display_percentage(
    capsys, execution_context, after_execution, swagger_20, current_line_length, endpoints_processed, percentage
):
    execution_context.current_line_length = current_line_length
    execution_context.endpoints_processed = endpoints_processed
    # When percentage is displayed
    default.display_percentage(execution_context, after_execution)
    out = capsys.readouterr().out
    # Then the whole line fits precisely to the terminal width
    assert len(click.unstyle(out)) + current_line_length == default.get_terminal_width()
    # And the percentage displayed as expected in cyan color
    assert out.strip() == click.style(percentage, fg="cyan")