-
-
Notifications
You must be signed in to change notification settings - Fork 684
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to pass down arguments + test.
- Loading branch information
1 parent
45fb7c4
commit 79e6a8f
Showing
3 changed files
with
27 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import typer | ||
|
||
import subprocess | ||
|
||
app = typer.Typer() | ||
|
||
|
||
@app.command() | ||
def main(i: int): | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
app(prog_name="custom-name") |
11 changes: 11 additions & 0 deletions
11
tests/test_tutorial/test_options/test_help/test_prog_name.py
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,11 @@ | ||
import subprocess | ||
|
||
|
||
def test_custom_prog_name(): | ||
result = subprocess.run( | ||
["python", "prog_name.py", "--help"], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
encoding="utf-8", | ||
) | ||
assert "custom-name" in result |
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