diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..9b148c87 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,4 @@ +[run] +source = notification +omit = notification/tests/* +branch = 1 diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 117d64c7..00000000 --- a/.pylintrc +++ /dev/null @@ -1,49 +0,0 @@ -[MASTER] -load-plugins=pinax.checkers.style -ignore:compat.py - -[MESSAGES CONTROL] -# Pointless whinging -# C0111 = Missing docstring -# C1001 = Old style classes -# R0904 = Too Many Public Methods -# I0011 = Locally Disabling -# W0232 = Class has no __init__ method -# R0903 = Too few public methods -# R0922 = Only one child of abstract base class -# R0201 = Method could be a function -# W0511 = Turn off warnings for TODO comments -# R0913 = Too many arguments - -disable=C0111,R0904,I0011,W0232,R0903,R0922,R0201,W0511,R0913,C9901,C1001 - -[REPORTS] -include-ids=yes -reports=no - -[BASIC] -good-names=n,i,j,k,x,e,Run,_,urlpatterns,setUp,qs,pk,register,logger - -# Regular expression which should only match correct function names -function-rgx=[a-z_][a-z0-9_]{2,60}$ - -# Regular expression which should only match correct method names -method-rgx=[a-z_][a-z0-9_]{2,60}$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{2,60}$ - -[DESIGN] -max-locals=20 - -[FORMAT] -max-line-length=100 - -[VARIABLES] -dummy-variables-rgx=^.*_$ - -[TYPECHECK] -generated-members=_default_manager,objects,DoesNotExist - -[MISCELLANEOUS] -notes=FIXME,XXX,TODO,@@@ diff --git a/.travis.yml b/.travis.yml index b6683b78..d069dcb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,13 +2,15 @@ language: python python: - "2.7" env: - - DJANGO=1.4.8 - - DJANGO=1.5.4 + - DJANGO=1.4.13 + - DJANGO=1.5.8 + - DJANGO=1.6.5 install: - - pip install -q Django==$DJANGO - - pip install -q django-nose - - pip install -q flake8 - pip install -e . -script: + - pip install -q Django==$DJANGO flake8 coverage coveralls +before_script: - flake8 --max-line-length=100 --max-complexity=10 --statistics --benchmark notification - - python runtests.py +script: + - coverage run runtests.py +after_script: + - coveralls diff --git a/runtests.py b/runtests.py index 82a85b5d..e8618f1a 100644 --- a/runtests.py +++ b/runtests.py @@ -1,16 +1,13 @@ +#!/usr/bin/env python +import os import sys +import django + from django.conf import settings -settings.configure( - DEBUG=True, - USE_TZ=True, - DATABASES={ - "default": { - "ENGINE": "django.db.backends.sqlite3", - } - }, - ROOT_URLCONF="notification.urls", + +DEFAULT_SETTINGS = dict( INSTALLED_APPS=[ "django.contrib.auth", "django.contrib.contenttypes", @@ -19,15 +16,42 @@ "notification", "notification.tests", ], - STRIPE_PUBLIC_KEY="", - STRIPE_SECRET_KEY="", - PAYMENTS_PLANS={}, + DATABASES={ + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": ":memory:", + } + }, + SITE_ID=1, + ROOT_URLCONF="notification.urls", + SECRET_KEY="notasecret", ) -from django_nose import NoseTestSuiteRunner -test_runner = NoseTestSuiteRunner(verbosity=1) -failures = test_runner.run_tests(["notification"]) +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() -if failures: + 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 = ["notification.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:]) diff --git a/tox.ini b/tox.ini index 87f0b4a2..315a27d6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27-django14,py27-django15,py27-django16,py33-django16 +envlist = py27-django14,py27-django15,py27-django16 [testenv] downloadcache = {toxworkdir}/cache/ @@ -10,29 +10,17 @@ deps = [testenv:py27-django14] basepython = python2.7 deps = - Django==1.4.8 + Django==1.4.13 {[testenv]deps} [testenv:py27-django15] basepython = python2.7 deps = - Django==1.5.4 + Django==1.5.8 {[testenv]deps} [testenv:py27-django16] basepython = python2.7 deps = - https://www.djangoproject.com/download/1.6b4/tarball/ - {[testenv]deps} - -[testenv:py33-django15] -basepython = python3.3 -deps = - Django==1.5.4 - {[testenv]deps} - -[testenv:py33-django16] -basepython = python3.3 -deps = - https://www.djangoproject.com/download/1.6b4/tarball/ + Django==1.6.5 {[testenv]deps}