Make use of coverage.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,3 +9,5 @@ MANIFEST
|
|||||||
.tox/
|
.tox/
|
||||||
*.egg
|
*.egg
|
||||||
docs/_build/
|
docs/_build/
|
||||||
|
.coverage
|
||||||
|
htmlcov
|
@@ -1,8 +1,11 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import coverage
|
||||||
|
from os.path import join
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.core.management import call_command
|
||||||
|
|
||||||
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
|
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
@@ -28,9 +31,23 @@ from django.test.simple import run_tests
|
|||||||
def runtests(*test_args):
|
def runtests(*test_args):
|
||||||
if not test_args:
|
if not test_args:
|
||||||
test_args = ['tests']
|
test_args = ['tests']
|
||||||
parent = os.path.join(TEST_DIR, "..", "..")
|
parent_dir = os.path.join(TEST_DIR, "..", "..")
|
||||||
sys.path.insert(0, parent)
|
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)
|
failures = run_tests(test_args, verbosity=1, interactive=True)
|
||||||
|
cov.stop()
|
||||||
|
cov.save()
|
||||||
sys.exit(failures)
|
sys.exit(failures)
|
||||||
|
|
||||||
|
|
||||||
|
24
tox.ini
24
tox.ini
@@ -1,8 +1,17 @@
|
|||||||
[testenv]
|
[testenv]
|
||||||
distribute=false
|
distribute = false
|
||||||
sitepackages=true
|
sitepackages = true
|
||||||
commands =
|
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]
|
[testenv:py25-1.1.X]
|
||||||
basepython = python2.5
|
basepython = python2.5
|
||||||
@@ -10,6 +19,7 @@ deps =
|
|||||||
unittest2
|
unittest2
|
||||||
BeautifulSoup
|
BeautifulSoup
|
||||||
html5lib
|
html5lib
|
||||||
|
coverage
|
||||||
django==1.1.4
|
django==1.1.4
|
||||||
|
|
||||||
[testenv:py26-1.1.X]
|
[testenv:py26-1.1.X]
|
||||||
@@ -18,6 +28,7 @@ deps =
|
|||||||
unittest2
|
unittest2
|
||||||
BeautifulSoup
|
BeautifulSoup
|
||||||
html5lib
|
html5lib
|
||||||
|
coverage
|
||||||
django==1.1.4
|
django==1.1.4
|
||||||
|
|
||||||
[testenv:py27-1.1.X]
|
[testenv:py27-1.1.X]
|
||||||
@@ -26,6 +37,7 @@ deps =
|
|||||||
unittest2
|
unittest2
|
||||||
BeautifulSoup
|
BeautifulSoup
|
||||||
html5lib
|
html5lib
|
||||||
|
coverage
|
||||||
django==1.1.4
|
django==1.1.4
|
||||||
|
|
||||||
|
|
||||||
@@ -35,6 +47,7 @@ deps =
|
|||||||
unittest2
|
unittest2
|
||||||
BeautifulSoup
|
BeautifulSoup
|
||||||
html5lib
|
html5lib
|
||||||
|
coverage
|
||||||
django==1.2.5
|
django==1.2.5
|
||||||
|
|
||||||
[testenv:py26-1.2.X]
|
[testenv:py26-1.2.X]
|
||||||
@@ -43,6 +56,7 @@ deps =
|
|||||||
unittest2
|
unittest2
|
||||||
BeautifulSoup
|
BeautifulSoup
|
||||||
html5lib
|
html5lib
|
||||||
|
coverage
|
||||||
django==1.2.5
|
django==1.2.5
|
||||||
|
|
||||||
[testenv:py27-1.2.X]
|
[testenv:py27-1.2.X]
|
||||||
@@ -51,6 +65,7 @@ deps =
|
|||||||
unittest2
|
unittest2
|
||||||
BeautifulSoup
|
BeautifulSoup
|
||||||
html5lib
|
html5lib
|
||||||
|
coverage
|
||||||
django==1.2.5
|
django==1.2.5
|
||||||
|
|
||||||
|
|
||||||
@@ -60,6 +75,7 @@ deps =
|
|||||||
unittest2
|
unittest2
|
||||||
BeautifulSoup
|
BeautifulSoup
|
||||||
html5lib
|
html5lib
|
||||||
|
coverage
|
||||||
django==1.3
|
django==1.3
|
||||||
|
|
||||||
[testenv:py26-1.3.X]
|
[testenv:py26-1.3.X]
|
||||||
@@ -68,6 +84,7 @@ deps =
|
|||||||
unittest2
|
unittest2
|
||||||
BeautifulSoup
|
BeautifulSoup
|
||||||
html5lib
|
html5lib
|
||||||
|
coverage
|
||||||
django==1.3
|
django==1.3
|
||||||
|
|
||||||
[testenv:py27-1.3.X]
|
[testenv:py27-1.3.X]
|
||||||
@@ -76,4 +93,5 @@ deps =
|
|||||||
unittest2
|
unittest2
|
||||||
BeautifulSoup
|
BeautifulSoup
|
||||||
html5lib
|
html5lib
|
||||||
|
coverage
|
||||||
django==1.3
|
django==1.3
|
||||||
|
Reference in New Issue
Block a user