Permalink
Browse files

Add test coverae support (via ./bin/django-1.X test_coverage)

  • Loading branch information...
1 parent 98d5c6e commit 46c9364045d068b0eaa2d73824beab61f8e7bdde @jacobian jacobian committed Aug 17, 2009
Showing with 44 additions and 4 deletions.
  1. +2 −1 .gitignore
  2. +10 −1 buildout.cfg
  3. +0 −1 src/jellyroll/providers/__init__.py
  4. +32 −1 src/jellyroll/testsettings.py
View
@@ -7,4 +7,5 @@ dist
downloads
eggs
parts
-src/*.egg-info
+src/*.egg-info
+coverage
View
@@ -1,12 +1,19 @@
[buildout]
-parts = python django-1.0 django-1.1
+parts = python django-1.0 django-1.1 coverage
develop = .
eggs = jellyroll
+ coverage
[python]
recipe = zc.recipe.egg
interpreter = python
eggs = ${buildout:eggs}
+extra-paths = ${coverage:location}
+
+[coverage]
+recipe = iw.recipe.subversion
+urls =
+ http://opensource.55minutes.com/svn/python/trunk/django/apps/test_coverage/@41 test_coverage
[django-1.0]
recipe = djangorecipe
@@ -17,6 +24,7 @@ settings = testsettings
test = jellyroll
testrunner = test-1.0
eggs = ${buildout:eggs}
+extra-paths = ${python:extra-paths}
[django-1.1]
recipe = djangorecipe
@@ -27,3 +35,4 @@ settings = testsettings
test = jellyroll
testrunner = test-1.1
eggs = ${buildout:eggs}
+extra-paths = ${python:extra-paths}
@@ -25,7 +25,6 @@ def active_providers():
mod = __import__(p, '', '', [''])
except ImportError, e:
log.error("Couldn't import provider %r: %s" % (p, e))
- raise
if mod.enabled():
providers[p] = mod
return providers
@@ -1,3 +1,34 @@
+import os
+
+BASE = os.path.abspath(os.path.dirname(__file__))
+
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/tmp/jellyroll.db'
-INSTALLED_APPS = ['django.contrib.contenttypes', 'tagging', 'jellyroll']
+INSTALLED_APPS = ['django.contrib.contenttypes', 'tagging', 'jellyroll']
+
+JELLYROLL_PROVIDERS = ['jellyroll.providers.%s' % p[:-3]
+ for p in os.listdir(os.path.join(BASE, 'providers'))
+ if p.endswith('.py') and not p.startswith('_')]
+
+# Silence logging
+import logging
+
+class Silence(logging.Handler):
+ def emit(self, record):
+ pass
+
+logging.getLogger("jellyroll").addHandler(Silence())
+
+# Coverage, if installed
+try:
+ from test_coverage.settings import *
+except ImportError:
+ pass
+else:
+ INSTALLED_APPS.append('test_coverage')
+
+ COVERAGE_REPORT_HTML_OUTPUT_DIR = os.path.join(os.path.dirname(os.path.dirname(BASE)), 'coverage')
+ COVERAGE_MODULE_EXCLUDES = ['^django\.', '^tagging\.', 'settings$', '\.templates$', '\.fixtures$']
+
+ if not os.path.exists(COVERAGE_REPORT_HTML_OUTPUT_DIR):
+ os.mkdir(COVERAGE_REPORT_HTML_OUTPUT_DIR)

0 comments on commit 46c9364

Please sign in to comment.