generated from BrianPugh/python-template
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from BrianPugh/version-help-flag-parameters
Use last command's help/version flags.
- Loading branch information
Showing
4 changed files
with
54 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,4 +143,4 @@ def test_create_burger_3(): | |
|
||
|
||
if __name__ == "__main__": | ||
test_create_burger_1() | ||
app() |
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,33 @@ | ||
"""From issue #219.""" | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"cmd", | ||
[ | ||
"foo --version 1.2.3", | ||
"foo --version=1.2.3", | ||
], | ||
) | ||
def test_version_subapp_version_parameter(app, assert_parse_args, cmd): | ||
@app.command(version_flags=[]) | ||
def foo(version: str): | ||
pass | ||
|
||
assert_parse_args(foo, cmd, version="1.2.3") | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"cmd", | ||
[ | ||
"foo --help 1.2.3", | ||
"foo --help=1.2.3", | ||
], | ||
) | ||
def test_version_subapp_help_parameter(app, assert_parse_args, cmd): | ||
@app.command(help_flags=[]) | ||
def foo(help: str): | ||
pass | ||
|
||
assert_parse_args(foo, cmd, help="1.2.3") |