AutomatedChaos
AutomatedChaos

Reputation: 7490

How to run a module from the command line with options?

Modules in python can be run from the pipeline with the -m option:

python -m pytest

This runs pytest with the advantage that the current directory is added to sys.path.
Now I want to run pytest with the -verbose option, but surrounding it with quotes/ticks does not work:

python -m pytest -verbose
python -m "pytest -verbose"
python -m 'pytest -verbose'
python -m `pytest -verbose`

How do I use options when running pytest with python from the CLI?

EDIT: The comment from Dinari solved it, I mistakenly used -verbose instead of --verbose

Upvotes: 0

Views: 141

Answers (1)

Aiyush
Aiyush

Reputation: 214

You should use:

python -m pytest --verbose instead

Notice the double dash instead of the single dash.

You use the single dash when using the short version usually -v ,however, here you use —verbose as you are using the long version.

Upvotes: 1

Related Questions