tayyaba ishaq
tayyaba ishaq

Reputation: 123

'py.test' is not recognized as the name of a cmdlet, function, script file, or operable program

Hi I am trying to run my tests using "py.test" command in the Pycharm terminal but every time is am getting this error message:

py.test : The term 'py.test' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

Upvotes: 12

Views: 27662

Answers (2)

satish021993
satish021993

Reputation: 41

while pytest was not working for me, even after reinstalling pytest.

then finally python -m pytest worked for me.

Upvotes: 4

Moshe
Moshe

Reputation: 521

First anwser:

Check if python -m pytest or just pytest works for you. If it does - maybe you have installed pytest in a different env/global env. That can make pytest library unavailable/unreachable in your environment. If the command does not work for you - make sure you have installed pytest library: pip install pytest

Second answer:

Try to change the default shell inside Pycharm to use CMD (I think you are using PowerShell?), then restart pycharm. Make sure you are using CMD as your default shell inside the pycharm terminal. enter image description here

Upvotes: 14

Related Questions