Repository navigation
First Check
Commit to Help
Example Codefrom typer import Typer
from typer.testing import CliRunner
app = Typer(help="My cool Typer app!")
@app.callback(invoke_without_command=True, no_args_is_help=True)
def main() -> None:
return None
# Comment below and the bug no longer occurs
#@app.command()
#def hello():
# return None
runner = CliRunner()
result = runner.invoke(app, ["--help"])
# We expect the exit code to be 0, but it will return exit_code 1 and an exception
assert result.exit_code == 0, result.exceptionDescriptionThere is a small regression introduced in #567. If a I tracked the problem down to this code. The fix is to add a check that I have not reviewed the source completely yet to know what a default command length should be, but I will and I am happy to contribute a fix. Operating SystemmacOS Operating System DetailsNo response Typer Version0.12.2 Python Version3.10.14 Additional ContextNo response |
Answered by
svlandeg
Apr 9, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the report and the reproducable code! This is fixed by #796 and I used your code to create a unit test for it 🙏