Skip to content
This repository has been archived by the owner on Nov 25, 2017. It is now read-only.

Commit

Permalink
Add test coverae support (via ./bin/django-1.X test_coverage)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobian committed Aug 17, 2009
1 parent 98d5c6e commit 46c9364
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -7,4 +7,5 @@ dist
downloads
eggs
parts
src/*.egg-info
src/*.egg-info
coverage
11 changes: 10 additions & 1 deletion buildout.cfg
@@ -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
Expand All @@ -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
Expand All @@ -27,3 +35,4 @@ settings = testsettings
test = jellyroll
testrunner = test-1.1
eggs = ${buildout:eggs}
extra-paths = ${python:extra-paths}
1 change: 0 additions & 1 deletion src/jellyroll/providers/__init__.py
Expand Up @@ -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
Expand Down
33 changes: 32 additions & 1 deletion src/jellyroll/testsettings.py
@@ -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.