12

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 

2 Answers 2

14

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

Sign up to request clarification or add additional context in comments.

Comments

4

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

then finally python -m pytest worked for me.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.