I decided to give it a go.
Virtualenv is up (python 3.5.2) pip install -U pytest (according to: https://docs.pytest.org/en/latest/getting-started.html).
Next documentation says I should run:
$ pytest --version
This is pytest version 3.x.y, imported from $PYTHON_PREFIX/lib/python3.6/site-packages/pytest.py
But this is actually what I got:
$ pytest --version
Usage: pytest [OPTIONS] [testfile [testpattern]]
examples:
pytest path/to/mytests.py
pytest path/to/mytests.py TheseTests
pytest path/to/mytests.py TheseTests.test_thisone
pytest path/to/mytests.py -m '(not long and database) or regr'
pytest one (will run both test_thisone and test_thatone)
pytest path/to/mytests.py -s not (will skip test_notthisone)
pytest: error: no such option: --version
But if I run:
py.test --version
This is pytest version 3.9.1, imported from ${HOME}/${V_ENV}/lib/python3.5/site-packages/pytest.py
According to that answer:
py.test is old (deprecated
they say) and pytest is way to go.
I checked both of them:
$ which pytest
$HOME/$V_ENV/bin/pytest
$ which py.test
$HOME/$V_ENV/bin/py.test
Exactly same files.
$HOME is my home, but $V_ENV is where I keep my virutalenvs (I use virtualenvwrapper).
When running tests:
It works:
$ py.test tests/
It does not (exception):
$ pytest tests/
I checked stack trace.
py.test runs using python3 (correct) pytest runs using python2 (incorrect, it's from os)
Anyone knows what is going on?
Also looks like py.test and pytest are exactly the same, so this notion of not using py.test seems a bit obsolete. Am I correct in saying that?