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

Viewed 2293

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

  • py.test
  •   + CategoryInfo          : ObjectNotFound: (py.test:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
1 Answers

First anwser:

check if python -m pytest or just pytest works for you, if it is - maybe you have installed pytest in a different env/global env, what makes pytest libary unavailable/unreachable in your environment. if the command does not work for you - make sure you have installed pytest libary pip insall pytest

Second anwser:

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 pycharm terminal. enter image description here

Related