Skip to content
Browse files

Moved away from own test runner and use django-discover-runner instead.

  • Loading branch information...
1 parent ebb3bdc commit 9691adc8d2664c1658e269b8a3cbc0fd35dec510 @jezdez jezdez committed May 29, 2012
Showing with 52 additions and 62 deletions.
  1. +2 −1 .gitignore
  2. +13 −2 .travis.yml
  3. +3 −0 Makefile
  4. +2 −0 README.rst
  5. +16 −0 floppyforms/test_settings.py
  6. +3 −0 requirements/tests.txt
  7. +0 −57 runtests.py
  8. +0 −1 setup.py
  9. +13 −1 tox.ini
View
3 .gitignore
@@ -1,4 +1,5 @@
django_floppyforms.egg-info
dist
-.tox
docs/_build
+.coverage
+.tox/
View
15 .travis.yml
@@ -2,10 +2,21 @@ language: python
python:
- "2.6"
- "2.7"
+ - "pypy"
env:
- DJANGO_VERSION=1.3.1
- DJANGO_VERSION=1.4
+before_install:
+ - export PIP_USE_MIRRORS=true
+ - export PIP_INDEX_URL=https://simple.crate.io/
+ - export DJANGO_SETTINGS_MODULE=floppyforms.test_settings
install:
- - pip install Django==$DJANGO_VERSION --use-mirrors
+ - pip install -e .
+ - pip install -r requirements/tests.txt Django==$DJANGO_VERSION
+before_script:
+ - flake8 floppyforms --ignore=E501
script:
- - python setup.py test
+ - make test
+branches:
+ only:
+ - master
View
3 Makefile
@@ -0,0 +1,3 @@
+test:
+ coverage run --branch --source=floppyforms `which django-admin.py` test floppyforms
+ coverage report --omit=floppyforms/test*
View
2 README.rst
@@ -2,6 +2,8 @@ Django-floppyforms
==================
.. image:: https://secure.travis-ci.org/brutasse/django-floppyforms.png
+ :alt: Build Status
+ :target: http://travis-ci.org/brutasse/django-floppyforms
Full control of form rendering in the templates.
View
16 floppyforms/test_settings.py
@@ -0,0 +1,16 @@
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': 'floppyforms.sqlite',
+ },
+}
+
+INSTALLED_APPS = [
+ 'django.contrib.gis',
+ 'floppyforms',
+ 'floppyforms.tests',
+]
+
+STATIC_URL = '/static/'
+
+TEST_RUNNER = 'discover_runner.DiscoverRunner'
View
3 requirements/tests.txt
@@ -0,0 +1,3 @@
+coverage
+flake8
+django-discover-runner
View
57 runtests.py
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-import os
-import sys
-
-from django.conf import settings
-try:
- from django.utils.functional import empty
-except ImportError:
- empty = None # noqa
-
-
-def setup_test_environment():
- # reset settings
- settings._wrapped = empty
-
- apps = [
- 'django.contrib.gis',
- 'floppyforms',
- 'floppyforms.tests',
- ]
-
- settings_dict = {
- 'DATABASES': {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': 'floppyforms.sqlite',
- },
- },
- 'INSTALLED_APPS': apps,
- 'STATIC_URL': '/static/',
- }
-
- # set up settings for running tests for all apps
- settings.configure(**settings_dict)
-
-
-def runtests(*test_args):
- setup_test_environment()
-
- parent = os.path.dirname(os.path.abspath(__file__))
- sys.path.insert(0, parent)
- try:
- from django.test.simple import DjangoTestSuiteRunner
-
- def run_tests(test_args, verbosity, interactive):
- runner = DjangoTestSuiteRunner(
- verbosity=verbosity, interactive=interactive, failfast=False)
- return runner.run_tests(test_args)
- except ImportError:
- # for Django versions that don't have DjangoTestSuiteRunner
- from django.test.simple import run_tests
- failures = run_tests(test_args, verbosity=1, interactive=True)
- sys.exit(failures)
-
-
-if __name__ == '__main__':
- runtests()
View
1 setup.py
@@ -23,6 +23,5 @@
'Natural Language :: English',
'Programming Language :: Python',
],
- test_suite='runtests.runtests',
zip_safe=False,
)
View
14 tox.ini
@@ -6,7 +6,9 @@ envlist =
docs
[testenv]
-commands = python setup.py test
+commands = make test
+setenv =
+ DJANGO_SETTINGS_MODULE = floppyforms.test_settings
[testenv:docs]
changedir = docs
@@ -19,48 +21,58 @@ commands =
basepython = python2.5
deps =
Django==1.3.1
+ -r{toxinidir}/requirements/tests.txt
[testenv:py26-1.3]
basepython = python2.6
deps =
Django==1.3.1
+ -r{toxinidir}/requirements/tests.txt
[testenv:py26-1.4]
basepython = python2.6
deps =
Django==1.4
+ -r{toxinidir}/requirements/tests.txt
[testenv:py26-trunk]
basepython = python2.6
deps =
https://github.com/django/django/tarball/master#egg=Django
+ -r{toxinidir}/requirements/tests.txt
[testenv:py27-1.3]
basepython = python2.7
deps =
Django==1.3.1
+ -r{toxinidir}/requirements/tests.txt
[testenv:py27-1.4]
basepython = python2.7
deps =
Django==1.4
+ -r{toxinidir}/requirements/tests.txt
[testenv:py27-trunk]
basepython = python2.7
deps =
https://github.com/django/django/tarball/master#egg=Django
+ -r{toxinidir}/requirements/tests.txt
[testenv:pypy-1.3]
basepython = pypy
deps =
Django==1.3.1
+ -r{toxinidir}/requirements/tests.txt
[testenv:pypy-1.4]
basepython = pypy
deps =
Django==1.4
+ -r{toxinidir}/requirements/tests.txt
[testenv:pypy-trunk]
basepython = pypy
deps =
https://github.com/django/django/tarball/master#egg=Django
+ -r{toxinidir}/requirements/tests.txt

0 comments on commit 9691adc

Please sign in to comment.
Something went wrong with that request. Please try again.