Skip to content

Commit

Permalink
Update some infrastructure to match pinax-starter-app
Browse files Browse the repository at this point in the history
  • Loading branch information
brosner committed Sep 21, 2015
1 parent b46d973 commit 6df1d3f
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
source = account
omit = account/tests/*
branch = 1

[report]
omit = account/tests/*
16 changes: 9 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ python:
- "3.3"
- "3.4"
env:
- DJANGO=1.7 DJANGO_VERSION_MIN=1.7 DJANGO_VERSION_MAX=1.8
- DJANGO=1.8 DJANGO_VERSION_MIN=1.8 DJANGO_VERSION_MAX=1.9
- DJANGO=1.7
- DJANGO=1.8
- DJANGO=master
matrix:
exclude:
- python: "3.3"
env: DJANGO=master
install:
- pip install -q "Django>=$DJANGO_VERSION_MIN,<$DJANGO_VERSION_MAX"
- pip install -q django-nose coverage coveralls flake8
- pip install -e .
- pip install tox coveralls
script:
- flake8 account
- coverage run runtests.py
- tox -e py${TRAVIS_PYTHON_VERSION//[.]/}-$DJANGO
after_script:
- coveralls
46 changes: 31 additions & 15 deletions runtests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
import os
import sys

Expand All @@ -6,42 +7,57 @@
from django.conf import settings


settings.configure(
DEFAULT_SETTINGS = dict(
DEBUG=True,
USE_TZ=True,
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
},
ROOT_URLCONF="account.urls",
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.messages",
"account",
"account.tests",
],
MIDDLEWARE_CLASSES=[
"django.contrib.sessions.middleware.SessionMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.auth.middleware.SessionAuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
],
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
},
SITE_ID=1,
TEMPLATE_DIRS=[
os.path.abspath(os.path.join(os.path.dirname(__file__), "account", "tests", "templates")),
]
ROOT_URLCONF="account.tests.urls",
SECRET_KEY="notasecret",
)

if hasattr(django, "setup"):

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

django.setup()

from django_nose import NoseTestSuiteRunner
parent = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, parent)

test_runner = NoseTestSuiteRunner(verbosity=1)
failures = test_runner.run_tests(["account"])
try:
from django.test.runner import DiscoverRunner
runner_class = DiscoverRunner
test_args = ["account.tests"]
except ImportError:
from django.test.simple import DjangoTestSuiteRunner
runner_class = DjangoTestSuiteRunner
test_args = ["tests"]

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


if __name__ == "__main__":
runtests(*sys.argv[1:])
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"locale/*/LC_MESSAGES/*",
],
},
test_suite="runtests.runtests",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
Expand Down
70 changes: 70 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,72 @@
[flake8]
ignore = E265,E501
max-line-length = 100
max-complexity = 10

[tox]
envlist =
py27-1.7, py27-1.8, py27-master,
py33-1.7, py33-1.8,
py34-1.7, py34-1.8, py34-master

[testenv]
deps =
flake8 == 2.4.1
coverage == 3.7.1
usedevelop = True
setenv =
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=en_US.UTF-8
commands =
coverage run setup.py test
coverage report -m
flake8 pinax

[testenv:py27-1.7]
basepython = python2.7
deps =
{[testenv]deps}
Django<1.8

[testenv:py27-1.8]
basepython = python2.7
deps =
{[testenv]deps}
Django<1.9

[testenv:py27-master]
basepython = python2.7
deps =
{[testenv]deps}
https://github.com/django/django/tarball/master

[testenv:py33-1.7]
basepython = python3.3
deps =
{[testenv]deps}
Django<1.8

[testenv:py33-1.8]
basepython = python3.3
deps =
{[testenv]deps}
Django<1.9

[testenv:py34-1.7]
basepython = python3.4
deps =
{[testenv]deps}
Django<1.8

[testenv:py34-1.8]
basepython = python3.4
deps =
{[testenv]deps}
Django<1.9

[testenv:py34-master]
basepython = python3.4
deps =
{[testenv]deps}
https://github.com/django/django/tarball/master

0 comments on commit 6df1d3f

Please sign in to comment.