Make use of coverage.

This commit is contained in:
Jannis Leidel
2011-05-13 10:59:48 +02:00
parent 6aed122aff
commit f09c85e59a
3 changed files with 42 additions and 5 deletions

2
.gitignore vendored
View File

@@ -9,3 +9,5 @@ MANIFEST
.tox/
*.egg
docs/_build/
.coverage
htmlcov

View File

@@ -1,8 +1,11 @@
#!/usr/bin/env python
import os
import sys
import coverage
from os.path import join
from django.conf import settings
from django.core.management import call_command
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -28,9 +31,23 @@ from django.test.simple import run_tests
def runtests(*test_args):
if not test_args:
test_args = ['tests']
parent = os.path.join(TEST_DIR, "..", "..")
sys.path.insert(0, parent)
parent_dir = os.path.join(TEST_DIR, "..", "..")
sys.path.insert(0, parent_dir)
cov = coverage.coverage(branch=True,
include=[
os.path.join(parent_dir, 'compressor', '*.py')
],
omit=[
join(parent_dir, 'compressor', 'tests', '*.py'),
join(parent_dir, 'compressor', 'utils', 'stringformat.py'),
join(parent_dir, 'compressor', 'filters', 'jsmin', 'rjsmin.py'),
join(parent_dir, 'compressor', 'filters', 'cssmin', 'cssmin.py'),
])
cov.load()
cov.start()
failures = run_tests(test_args, verbosity=1, interactive=True)
cov.stop()
cov.save()
sys.exit(failures)

24
tox.ini
View File

@@ -1,8 +1,17 @@
[testenv]
distribute=false
sitepackages=true
distribute = false
sitepackages = true
commands =
python compressor/tests/runtests.py
{envpython} compressor/tests/runtests.py
coverage html -d {envtmpdir}/coverage
[testenv:docs]
changedir = docs
deps =
Sphinx
commands =
make clean
make html
[testenv:py25-1.1.X]
basepython = python2.5
@@ -10,6 +19,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.1.4
[testenv:py26-1.1.X]
@@ -18,6 +28,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.1.4
[testenv:py27-1.1.X]
@@ -26,6 +37,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.1.4
@@ -35,6 +47,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.2.5
[testenv:py26-1.2.X]
@@ -43,6 +56,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.2.5
[testenv:py27-1.2.X]
@@ -51,6 +65,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.2.5
@@ -60,6 +75,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.3
[testenv:py26-1.3.X]
@@ -68,6 +84,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.3
[testenv:py27-1.3.X]
@@ -76,4 +93,5 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.3