'py.test' is not recognized as an internal or external command, operable program or batch file
I started learning python recently and I know my problem may not be sth complicated. I issued below command from my Windows cmd to install pytest framework and its required dependencies
py -3 -m pip install pytest
and then issued:
py -3 -m pip install pytest-pep8
to install pep8 plug-in and required dependencies. Both commands were done successfully.
But when I want to run pytest by
py.test --pep8 exp1.py command; I get mentioned error.
to run pytest along with geting output status in terminal run this in terminal:
pytest -v -s filename.py
if the file is not present, run this in the current directory:
pytest -v -s <filepath>/filename.py
The error you got seems to be due to improper installation of pytest or due to use of py.test in your command.
First, check whether you have pytest installed in your environment. Open command prompt and use the below command,
You must get an output like,
If you get an output similar to the above result that means you have installed pytest successfully.
Now, navigate to the folder where your script exp1.py is using cd command in cmd and try running your script as follows,
pytest --pep8 exp1.py