Skip to content

CliRunner.is_ok method? #1787

Closed
Closed

Description

@max-sixty

I frequently have code like:

result = cli_runner.invoke(foo.download, ["--date", date_str])
assert result.exit_code == 0, result.output

Would you take a PR that aliased the second line with an is_ok method?

assert result.is_ok()

This would return True if there were a zero exit code; otherwise it would raise with an error message of the output (and whatever else people think would be helpful).

Activity

  1. max-sixty commented on Feb 21, 2021

    @max-sixty
    ContributorAuthor

    This seems to be covered by catch_exceptions=False! Sorry for missing that. Closing.

  2. locked as resolved and limited conversation to collaborators on Mar 8, 2021
  3. added
    test runner
    on Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    test runner

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions