pytest-django plugin is not recognized by py.test as plugin on Ubuntu 14.04

Created on 18 Jun 2014  路  5Comments  路  Source: pytest-dev/pytest-django

Short description

the output of pip install pytest-django pytest-instafail && py.test no-such-path is

============================= test session starts ==============================
platform linux2 -- Python 2.7.6 -- py-1.4.20 -- pytest-2.5.2
plugins: instafail
ERROR: file not found: no-such-path

===============================  in 0.01 seconds ===============================

django is not listed among the plugins

Tested with python 2.7 on ubuntu trusty 64 on vagrant with pytest_django 2.6.2

To reproduce

Create a vagrant box

mkdir vagrant-pytest-does-not-recogniz-pytest-django-on-ubuntu-trusty64
cd vagrant-pytest-does-not-recogniz-pytest-django-on-ubuntu-trusty64
vagrant init ubuntu/trusty64
vagrant ssh

Install it into the global site-packages

(mkdir installing-into-global &&\
cd installing-into-global &&\
(wget http://peak.telecommunity.com/dist/ez_setup.py -O ez_setup.py &&\
sudo python ez_setup.py -U pip && \
sudo pip install pytest-django pytest-instafail && \
python --version &&\
pip freeze && \
which py.test && \
py.test no-such-path) 2>&1 | tee log)

Install it into a virtualenvironment

(mkdir installing-into-venv &&\
cd installing-into-venv &&\
sudo pip install virtualenv &&\
(virtualenv venvpytest --no-site-packages --no-setuptools --no-pip &&\
source venvpytest/bin/activate &&\
wget http://peak.telecommunity.com/dist/ez_setup.py -O ez_setup.py &&\
python ez_setup.py -U pip &&\
pip install pytest-django pytest-instafail &&\
python --version &&\
pip freeze &&\
 py.test no-such-path) 2>&1 | tee log)

Output from the above commands can be found at https://gist.github.com/zsoldosp/bdf8c82125df418759fe

bug

Most helpful comment

Just in case anyone else encounters this issue: for me, it was caused by an ancient version of setuptools. After upgrading from setuptools 0.6 to the latest version (currently 28.7.1), the plugin is correctly discovered.

All 5 comments

Confirmed, in a docker instance.

However, this appears to be fixed in master:

# git clone https://github.com/pelme/pytest_django
# cd pytest_django
# pip install -e .
# cd /tmp
# py.test --version
This is pytest version 2.5.2, imported from /usr/local/lib/python2.7/dist-packages/pytest.pyc
setuptools registered plugins:
  pytest-django-2.6.2 at /pytest_django/pytest_django/plugin.pyc
  pytest-instafail-0.2.0 at /usr/local/lib/python2.7/dist-packages/pytest_instafail.pyc

It might not be related to master, but because a wrong py.test is being picked up - e.g. because you need to call rehash with zsh after installing py.test - otherwise the system-wide py.test is being picked from the shell.
So, make sure to call the virtualenv/bin/py.test explicitly.

This might not be an issue here, but it's easy to forget.

I am closing this, according to my previous comment(s).

Please re-open in case it's still a problem for you, and then please also try it with installing pytest-django from master.

Just in case anyone else encounters this issue: for me, it was caused by an ancient version of setuptools. After upgrading from setuptools 0.6 to the latest version (currently 28.7.1), the plugin is correctly discovered.

I been struggle with this issue too, upgrading pip and reinstall distribute solved the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rlskoeser picture rlskoeser  路  7Comments

aljosa picture aljosa  路  8Comments

ojake picture ojake  路  6Comments

arne-cl picture arne-cl  路  8Comments

jedie picture jedie  路  7Comments