Skip to content

Update help in tests for latest Click #1354

@simonw

Description

@simonw

Now that Uvicorn 0.14 is out with an unpinned Click dependency - Kludex/uvicorn#1033 - our test suite runs against Click 8.0 - which subtly changes the output of --help causing test failures: https://github.com/simonw/datasette/runs/2720383031?check_suite_focus=true

    def test_help_includes(name, filename):
        expected = (docs_path / filename).read_text()
        runner = CliRunner()
        result = runner.invoke(cli, name.split() + ["--help"], terminal_width=88)
        actual = f"$ datasette {name} --help\n\n{result.output}"
        # actual has "Usage: cli package [OPTIONS] FILES"
        # because it doesn't know that cli will be aliased to datasette
        expected = expected.replace("Usage: datasette", "Usage: cli")
>       assert expected == actual
E       AssertionError: assert '$ datasette ...e and exit.\n' == '$ datasette ...e and exit.\n'
E         Skipping 848 identical leading characters in diff, use -v to show
E           nt_id xxx
E         + 
E             --version-note TEXT             Additional note to show on /-/versions
E             --secret TEXT                   Secret used for signing secure values, such as signed
E                                             cookies
E         + 
E             --title TEXT                    Title for metadata

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions