Skip to content

Commit

Permalink
Update the travis integration
Browse files Browse the repository at this point in the history
  • Loading branch information
paltman committed Jul 20, 2014
1 parent f1bc2cc commit b408c6d
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .coveragerc
@@ -0,0 +1,4 @@
[run]
source = mailer
omit = mailer/tests.py
branch = 1
14 changes: 9 additions & 5 deletions .travis.yml
@@ -1,11 +1,15 @@
language: python

python:
- 2.7

env:
- DJANGO=https://github.com/django/django/tarball/master
- DJANGO=Django==1.6.5
install:
- pip install flake8
- pip install -e .

script:
- pip install flake8 coverage coveralls $DJANGO
before_script:
- flake8 --max-line-length=100 --max-complexity=10 --statistics --benchmark mailer
script:
- coverage run runtests.py
after_script:
- coveralls
13 changes: 0 additions & 13 deletions mailer/test_settings.py

This file was deleted.

54 changes: 54 additions & 0 deletions runtests.py
@@ -0,0 +1,54 @@
#!/usr/bin/env python
import os
import sys

import django

from django.conf import settings


DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"mailer",
],
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
},
SITE_ID=1,
SECRET_KEY="notasecret",
)


def runtests(*test_args):
if not settings.configured:
settings.configure(**DEFAULT_SETTINGS)

# Compatibility with Django 1.7's stricter initialization
if hasattr(django, "setup"):
django.setup()

parent = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, parent)

try:
from django.test.runner import DiscoverRunner
runner_class = DiscoverRunner
test_args = ["mailer.tests"]
except ImportError:
from django.test.simple import DjangoTestSuiteRunner
runner_class = DjangoTestSuiteRunner
test_args = ["tests"]

failures = runner_class(
verbosity=1, interactive=True, failfast=False).run_tests(test_args)
sys.exit(failures)


if __name__ == "__main__":
runtests(*sys.argv[1:])

0 comments on commit b408c6d

Please sign in to comment.