Skip to content
Discussion options

You must be logged in to vote

Both scenarios are already covered, through the docs examples rather than tests/test_core.py. Every file under docs_src/ has a matching test under tests/test_tutorial/, and the Sub-Typer Callback Override tutorial uses exactly this "attach first, register later" order:

  • docs_src/subcommands/callback_override/tutorial003_py310.py creates users_app = typer.Typer(callback=default_callback), calls app.add_typer(users_app, name="users"), and only then registers @users_app.callback() and @users_app.command() create. tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial003.py checks that the late command works and that the late @callback() overrides Typer(callback=...).
  • tutor…

Replies: 1 comment

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
2 participants