Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zsoldosp opened this issue Jun 18, 2014 · 5 comments
Closed
Labels

Comments

@zsoldosp
Copy link
Contributor

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

@blueyed
Copy link
Contributor

blueyed commented Jul 3, 2014

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

@blueyed
Copy link
Contributor

blueyed commented Jul 3, 2014

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.

@blueyed
Copy link
Contributor

blueyed commented Jul 30, 2014

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.

@blueyed blueyed closed this as completed Jul 30, 2014
@blueyed blueyed added the bug label Jul 30, 2014
@dhepper
Copy link

dhepper commented Nov 2, 2016

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.

@yuri1992
Copy link

yuri1992 commented Mar 9, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants