-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Minicli version : 0.5.3
Pytest version : 8.3.0
When calling a minicli command with run
with an argument (e.g. run("test_method", test_arg="test")
) in a Pytest test, we get the following error:
argparse.ArgumentError: the following arguments are required: test_arg
Detailed example:
In the CLI commands definition file:
from minicli import cli
@cli
async def test_method(test_arg: str):
print(test_arg)
In a Pytest test.py
file:
from minicli import run
def test_call():
run("test_method", test_arg="test")
This is run with pytest test.py
.
Note: this does not happen when the CLI command has a default argument. In that case, the argument os properly passed and properly overrides the default argument, for example when the CLI is defined this way:
from minicli import cli
@cli
async def test_method(test_arg: str = "default"):
print(test_arg)
...then pytest test.py
will not fail and will properly output "test".
Metadata
Metadata
Assignees
Labels
No labels