Pytest and Python 3
In addition to the aforementioned python3 -m pytest
, this might also work:
env pytest
I found a workaround:
- Installed
python3-pip
using aptitude, which created/usr/bin/pip-3.2
. - Next
pip-3.2 install pytest
which re-installed pytest, but under a python3.2 path. - Then I was able to use
python3 -m pytest somedir/sometest.py
.
Not as convenient as running py.test directly, but workable.
This worked for me:
python3 $(which py.test) ...
python3 doesn't have the module py.test installed. If you can, install the python3-pytest
package.
If you can't do that try this:
- Install virtualenv
- Create a virtualenv for python3
virtualenv --python=python3 env_name
- Activate the virtualenv
source ./env_name/bin/activate
- Install py.test
pip install py.test
- Now using this virtualenv try to run your tests