-
-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔥 Remove auto naming of groups added via
add_typer
based on the gro…
…up's callback function name (#1052) Co-authored-by: svlandeg <[email protected]> Co-authored-by: Sebastián RamÃrez <[email protected]>
- Loading branch information
1 parent
45cbfcd
commit 2d1a598
Showing
10 changed files
with
109 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import pytest | ||
import typer | ||
from typer.testing import CliRunner | ||
|
||
runner = CliRunner() | ||
|
||
|
||
def test_warns_when_callback_is_not_supported(): | ||
app = typer.Typer() | ||
|
||
sub_app = typer.Typer() | ||
|
||
@sub_app.callback() | ||
def callback(): | ||
"""This help text is not used.""" | ||
|
||
app.add_typer(sub_app) | ||
|
||
with pytest.warns( | ||
match="The 'callback' parameter is not supported by Typer when using `add_typer` without a name" | ||
): | ||
try: | ||
app() | ||
except SystemExit: | ||
pass | ||
|
||
|
||
def test_warns_when_callback_is_not_supported_added_after_add_typer(): | ||
app = typer.Typer() | ||
|
||
sub_app = typer.Typer() | ||
app.add_typer(sub_app) | ||
|
||
@sub_app.callback() | ||
def callback(): | ||
"""This help text is not used.""" | ||
|
||
with pytest.warns( | ||
match="The 'callback' parameter is not supported by Typer when using `add_typer` without a name" | ||
): | ||
try: | ||
app() | ||
except SystemExit: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.