How do I run tox in a project that has no setup.py?
I also had to remove usedevelop = true
from my conf.
My configuration was looking like that:
[tox]
envlist = flake8,py36
[testenv]
usedevelop = true
install_command = pip install -U {opts} {packages}
deps =
py36: -r requirements.txt
py36: -r requirements-test.txt
flake8: flake8
commands=
flake8: flake8 app tests --ignore=E501,W503
py36: pytest {toxinidir}/tests {posargs}
I added skipsdist = true
as the other answers suggest. But it was not enough. As said above, also removing usedevelop = true
did the trick.
After digging inside the source code, I found a scarcely documented option in tox.ini that skips sdist:
[tox]
skipsdist = BOOL # defaults to false
Setting this to True
I got what I wanted, saving me the effort of writing a meaningful setup.py
This is my tox.ini
file content for Django project by multiple settings:
[tox]
envlist = py36-{accounting,content,media}_settings
skipsdist = true
[testenv]
commands = python {toxinidir}/manage.py test
deps = -r{toxinidir}/requirements.txt
setenv =
accounting_settings: DJANGO_SETTINGS_MODULE=my_project.settings.accounting
contents_settings: DJANGO_SETTINGS_MODULE=my_project.settings.contents
media_settings: DJANGO_SETTINGS_MODULE=my_project.settings.media
If you have an application (with a requirements.txt
), rather than a project that you are going to distribute (which would have a setup.py
instead), your tox.ini
should look something like this:
[tox]
skipsdist = True
[testenv]
deps = -r{toxinidir}/requirements.txt
Found this answer originally from David Murphy's blog, but the page is no longer available, you can find an archived version here: https://web.archive.org/web/20150112223937/https://blog.schwuk.com/2014/03/19/using-tox-django-projects/
(Original link, now dead: http://blog.schwuk.com/2014/03/19/using-tox-django-projects/ )