Skip to content

Instantly share code, notes, and snippets.

@asfaltboy
Created May 10, 2015 14:11
Show Gist options
  • Save asfaltboy/08d0ac84563b53ffed3c to your computer and use it in GitHub Desktop.
Save asfaltboy/08d0ac84563b53ffed3c to your computer and use it in GitHub Desktop.
tox django env matrix
import os
import sys
from django.conf import settings
import django
os.environ['DJANGO_SETTINGS_MODULE'] = 'app.tests.test_settings'
try:
from django.test.utils import get_runner
TestRunner = get_runner(settings)
test_runner = TestRunner()
except ImportError:
from django.test.simple import DjangoTestSuiteRunner
test_runner = DjangoTestSuiteRunner(verbosity=1, interactive=False)
try:
django.setup()
except AttributeError:
pass
failures = test_runner.run_tests(['app'], verbosity=1)
if failures:
sys.exit(failures)
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
[tox]
envlist =
{py26,py27}-django{14,15,16},
{py33}-django{15,16,17,18},
{py27,py34}-django{17,18},
[testenv]
deps =
django13: Django>=1.3,<1.4
django14: Django>=1.4,<1.5
django15: Django>=1.5,<1.6
django16: Django>=1.6,<1.7
django17: Django>=1.7,<1.8
django18: Django>=1.8,<1.9
commands = {envpython} runtests.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment