From 8b209acfb4b7c6bbbedd1afbf52990d67fed4eb9 Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Mon, 25 Nov 2013 22:44:36 +0100 Subject: [PATCH] Tox. Runtests. Travis. Yay. --- .coverage.rc | 7 +++++-- .travis.yml | 4 ++-- runtests.py | 33 +++++++++++++++++++++++++++++++++ tox.ini | 23 +++++++++++++++++++++++ 4 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 runtests.py create mode 100644 tox.ini diff --git a/.coverage.rc b/.coverage.rc index aae6480..69fbbd9 100644 --- a/.coverage.rc +++ b/.coverage.rc @@ -1,6 +1,6 @@ [run] -source = - dpaste +parallel = True +source = dpaste branch = True omit = dpaste/migrations/* @@ -10,3 +10,6 @@ omit = exclude_lines = pragma: no cover def __repr__ + +[html] +directory = /tmp/coverage_html_report diff --git a/.travis.yml b/.travis.yml index abb2e00..d4517bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,9 @@ python: - "2.7" - "3.3" install: + - "pip install Django==1.6 - "pip install -e ." - - "pip install -r requirements.txt" script: - coverage run --rcfile=.coverage.rc manage.py test + coverage run --rcfile=.coverage.rc runtests.py after_success: coveralls --config_file=.coverage.rc --coveralls_yaml=.coveralls.yml diff --git a/runtests.py b/runtests.py new file mode 100644 index 0000000..0037b20 --- /dev/null +++ b/runtests.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +import sys +from django.conf import settings + +if not settings.configured: + settings.configure( + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'dev.db', + } + }, + INSTALLED_APPS=[ + 'django.contrib.sessions', + 'django.contrib.staticfiles', + 'mptt', + 'dpaste', + ], + + STATIC_ROOT='/tmp/dpaste_test_static/', + STATIC_URL='/static/', + ROOT_URLCONF='dpaste.urls', + ) + +def runtests(*test_args): + from django.test.simple import DjangoTestSuiteRunner + test_runner = DjangoTestSuiteRunner(verbosity=1) + failures = test_runner.run_tests(['dpaste', ]) + if failures: + sys.exit(failures) + +if __name__ == '__main__': + runtests(*sys.argv[1:]) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..bcea6ba --- /dev/null +++ b/tox.ini @@ -0,0 +1,23 @@ +[tox] +toxworkdir={toxinidir}/.tox +envlist= + py27-django-1.4, + py27-django-1.5, + py27-django-1.6, + py33-django-1.6, + +[testenv] +commands= + python runtests.py + +[testenv:py27-django-1.4] +deps=django==1.4 + +[testenv:py27-django-1.5] +deps=django==1.5 + +[testenv:py27-django-1.6] +deps=django==1.6 + +[testenv:py33-django-1.6] +deps=django==1.6