Reputation: 1740
I've installed pytest 2.3.4 under Debian Linux. By default it runs under Python 2.7, but sometimes I'd like to run it under Python 3.x, which is also installed. I can't seem to find any instructions on how to do that.
The PyPI Trove classifiers show Python :: 3 so presumably it must be possible. Aside from py.test somedir/sometest.py
, I can use python -m pytest ...
, or even python2.7 -m pytest ...
, but if I try python3 -m pytest ...
I get
/usr/bin/python3: No module named pytest
Upvotes: 64
Views: 76824
Reputation: 1319
Debian Linux has the python3-pytest package where if installed you can simply run:
/usr/bin/pytest-3
Upvotes: 1
Reputation: 595
In addition to the aforementioned python3 -m pytest
, this might also work:
env pytest
Upvotes: 5
Reputation: 1740
I found a workaround:
python3-pip
using aptitude, which created /usr/bin/pip-3.2
. pip-3.2 install pytest
which re-installed pytest, but under a python3.2 path.python3 -m pytest somedir/sometest.py
.Not as convenient as running py.test directly, but workable.
Upvotes: 72
Reputation: 3059
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:
virtualenv --python=python3 env_name
source ./env_name/bin/activate
pip install py.test
Upvotes: 28