You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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:
...then pytest test.py will not fail and will properly output "test".
The text was updated successfully, but these errors were encountered:
bolinocroustibat
changed the title
Error when calling CLI method with an argument with run from Pytest
Error when calling CLI command with an argument with run from Pytest
Aug 22, 2024
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:
In a Pytest
test.py
file: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:
...then
pytest test.py
will not fail and will properly output "test".The text was updated successfully, but these errors were encountered: