Skip to content

Instantly share code, notes, and snippets.

@juanifioren
Last active April 13, 2018 17:39
Show Gist options
  • Save juanifioren/36f89f32a57c874e1e438a83d947df1d to your computer and use it in GitHub Desktop.
Save juanifioren/36f89f32a57c874e1e438a83d947df1d to your computer and use it in GitHub Desktop.
Tox with pytest, coverage, flake8, and django
SECRET_KEY = 'super-secret-key'
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'yourproject',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'testdb.sqlite3',
}
}
[tox]
envlist=
py34-django{111,20},
py35-django{111,20},
py36-django{111,20},
[testenv]
changedir=
yourproject/tests
deps =
psycopg2
pytest
pytest-django
pytest-flake8
pytest-cov
django111: django>=1.11,<1.12
django20: django>=2.0,<2.1
commands =
pytest --flake8 --cov=yourproject {posargs}
[pytest]
DJANGO_SETTINGS_MODULE = yourproject.tests.settings
python_files = test_*.py
flake8-max-line-length = 99
flake8-ignore =
.git ALL
__pycache__ ALL
.ropeproject ALL
*/migrations ALL
manage.py ALL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment