when I am trying to run my test through command line
py.test file_name.py
I got this error:
py.test: error: unrecognized argum
If the other answers here didn't work for you, you may have py.test installed somewhere else in your system. In my case, I ran into the issue described here inside a virtual environment, but it turned out that pytest was defaulting to my system installation (which did not have pytest-cov installed).
Deactivate your virtual environment or start a new shell and run the following to confirm:
pip3 freeze | grep pytest
(or pip freeze | grep pytest
if you're running python2)
If you find it, try uninstalling it, then reactivate your virtual environment and try again.