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

python setup.py test fails to install pytest #1685

Closed
skolsuper opened this issue Jun 28, 2016 · 6 comments
Closed

python setup.py test fails to install pytest #1685

skolsuper opened this issue Jun 28, 2016 · 6 comments

Comments

@skolsuper
Copy link

Environment is python3.5.1 virtualenv on macOSX. However I have the same issue when running in the python:3.5 docker container, which is where the output I include below comes from.

I am trying to test a django project using the pytest-django plugin and the pytest-runner package for running from setup.py.

This is the relevant part of my setup.py:

setup(
    ...
    setup_requires=[
        'pytest-runner',
    ],
    tests_require=[
        'pytest',
        'pytest-django',
    ],
)

Running python setup.py test results in the following output:

Installed /tmp/easy_install-vzn90ojy/pytest-runner-2.8/.eggs/setuptools_scm-1.11.1-py3.5.egg
zip_safe flag not set; analyzing archive contents...

Installed /usr/webapps/my_app/.eggs/pytest_runner-2.8-py3.5.egg
running pytest
Searching for pytest-django
Reading https://pypi.python.org/simple/pytest-django/
Best match: pytest-django 2.9.1
Downloading https://pypi.python.org/packages/50/6d/77a4644d15746ed2a243ed557af693cec7887e43b357919ba0b4fd029518/pytest-django-2.9.1.tar.gz#md5=3c9dde85e99ec409df209a62b4715e1a
Processing pytest-django-2.9.1.tar.gz
Writing /tmp/easy_install-ppvg7rkt/pytest-django-2.9.1/setup.cfg
Running pytest-django-2.9.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ppvg7rkt/pytest-django-2.9.1/egg-dist-tmp-uzcpfwy8

Installed /tmp/easy_install-ppvg7rkt/pytest-django-2.9.1/.eggs/setuptools_scm-1.8.0-py3.5.egg
warning: no previously-included files matching '*' found under directory 'pytest_django_test'
warning: no previously-included files matching '*' found under directory 'tests'
warning: no previously-included files matching '*' found under directory '.tox'
warning: no previously-included files matching '*' found under directory 'bin'
warning: no previously-included files matching '*' found under directory 'src'
warning: no previously-included files matching '*' found under directory '.git'
warning: no previously-included files matching '*' found under directory 'bin'
warning: no previously-included files matching '*' found under directory 'include'
warning: no previously-included files matching '*' found under directory 'lib'
warning: no previously-included files matching '*' found under directory 'share'
warning: no previously-included files matching '*' found under directory 'src'
zip_safe flag not set; analyzing archive contents...
pytest_django.__pycache__.plugin.cpython-35: module MAY be using inspect.stack
creating /usr/webapps/my_app/.eggs/pytest_django-2.9.1-py3.5.egg
Extracting pytest_django-2.9.1-py3.5.egg to /usr/webapps/my_app/.eggs

Installed /usr/webapps/my_app/.eggs/pytest_django-2.9.1-py3.5.egg
Searching for pytest
Best match: pytest django-2.9.1
Downloading https://pypi.python.org/packages/50/6d/77a4644d15746ed2a243ed557af693cec7887e43b357919ba0b4fd029518/pytest-django-2.9.1.tar.gz#md5=3c9dde85e99ec409df209a62b4715e1a
Processing pytest-django-2.9.1.tar.gz
Writing /tmp/easy_install-vl_5dvii/pytest-django-2.9.1/setup.cfg
Running pytest-django-2.9.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-vl_5dvii/pytest-django-2.9.1/egg-dist-tmp-w82jm2cu

Installed /tmp/easy_install-vl_5dvii/pytest-django-2.9.1/.eggs/setuptools_scm-1.8.0-py3.5.egg
warning: no previously-included files matching '*' found under directory 'pytest_django_test'
warning: no previously-included files matching '*' found under directory 'tests'
warning: no previously-included files matching '*' found under directory '.tox'
warning: no previously-included files matching '*' found under directory 'bin'
warning: no previously-included files matching '*' found under directory 'src'
warning: no previously-included files matching '*' found under directory '.git'
warning: no previously-included files matching '*' found under directory 'bin'
warning: no previously-included files matching '*' found under directory 'include'
warning: no previously-included files matching '*' found under directory 'lib'
warning: no previously-included files matching '*' found under directory 'share'
warning: no previously-included files matching '*' found under directory 'src'
zip_safe flag not set; analyzing archive contents...
pytest_django.__pycache__.plugin.cpython-35: module MAY be using inspect.stack
removing '/usr/webapps/my_app/.eggs/pytest_django-2.9.1-py3.5.egg' (and everything under it)
creating /usr/webapps/my_app/.eggs/pytest_django-2.9.1-py3.5.egg
Extracting pytest_django-2.9.1-py3.5.egg to /usr/webapps/my_app/.eggs

Installed /usr/webapps/my_app/.eggs/pytest_django-2.9.1-py3.5.egg
Traceback (most recent call last):
  File "setup.py", line 27, in <module>
    tests_require=test_requirements,
  File "/usr/local/lib/python3.5/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/lib/python3.5/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/webapps/my_app/.eggs/pytest_runner-2.8-py3.5.egg/ptr.py", line 73, in run
  File "/usr/local/lib/python3.5/site-packages/setuptools/dist.py", line 313, in fetch_build_eggs
    replace_conflicting=True,
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 839, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pytest' distribution was not found and is required by the application

Notice that the installer first installs pytest django, then installs it again instead of pytest:

Searching for pytest-django
Reading https://pypi.python.org/simple/pytest-django/
Best match: pytest-django 2.9.1
...
Searching for pytest
Best match: pytest django-2.9.1
Downloading 

Not sure if this is an issue with pytest, pytest-django, pytest-runner, setuptools or something else, so feel free to close this and point me to the right place to make an issue.

@skolsuper
Copy link
Author

Incidentally, while typing this up, I fixed the issue by pinning pytest==2.9.2 in test_requirements.

@RonnyPfannschmidt
Copy link
Member

Looks like setuptools

@RonnyPfannschmidt
Copy link
Member

closing this one a setuptools issue

@astrojuanlu
Copy link

I was bitten by this today. Do you know which setuptools bug is this, and whether it was fixed?

@astrojuanlu
Copy link

Self answer pypa/setuptools#196

@RonnyPfannschmidt
Copy link
Member

@Juanlu001 thanks for finding the reference

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

No branches or pull requests

3 participants