diff --git a/.gitignore b/.gitignore index 9d802fb..3780c1e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ MANIFEST .tox/ *.egg docs/_build/ +.coverage +htmlcov \ No newline at end of file diff --git a/compressor/tests/runtests.py b/compressor/tests/runtests.py index 740f30b..0b8dea1 100644 --- a/compressor/tests/runtests.py +++ b/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__)) @@ -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) diff --git a/tox.ini b/tox.ini index f411f82..065a55b 100644 --- a/tox.ini +++ b/tox.ini @@ -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