Skip to content

Adding returns to command #729

Answered by lachaib
PCanavelli asked this question in Questions
Discussion options

You must be logged in to vote

When working with CLI, the return value is generally discarded. You can pass a return code using sys.exit or Typer's equivalent. That way you can assert on the exit code (result.exit_code), or print (or use Typer.echo) and assert on the output result.output as suggested by @melsabagh.
Outside of the scope of testing, where would you expect the return of the command to go to?

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by svlandeg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
3 participants