Skip to content

Commit

Permalink
Make use of coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
jezdez committed May 13, 2011
1 parent 6aed122 commit f09c85e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -9,3 +9,5 @@ MANIFEST
.tox/
*.egg
docs/_build/
.coverage
htmlcov
21 changes: 19 additions & 2 deletions compressor/tests/runtests.py
@@ -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__))

Expand All @@ -28,9 +31,23 @@
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)


Expand Down
24 changes: 21 additions & 3 deletions tox.ini
@@ -1,15 +1,25 @@
[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
deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.1.4

[testenv:py26-1.1.X]
Expand All @@ -18,6 +28,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.1.4

[testenv:py27-1.1.X]
Expand All @@ -26,6 +37,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.1.4


Expand All @@ -35,6 +47,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.2.5

[testenv:py26-1.2.X]
Expand All @@ -43,6 +56,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.2.5

[testenv:py27-1.2.X]
Expand All @@ -51,6 +65,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.2.5


Expand All @@ -60,6 +75,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.3

[testenv:py26-1.3.X]
Expand All @@ -68,6 +84,7 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.3

[testenv:py27-1.3.X]
Expand All @@ -76,4 +93,5 @@ deps =
unittest2
BeautifulSoup
html5lib
coverage
django==1.3

0 comments on commit f09c85e

Please sign in to comment.