43 lines
1,016 B
Python
43 lines
1,016 B
Python
#!/usr/bin/env python
|
|
|
|
import sys
|
|
import coverage
|
|
|
|
|
|
def runtests():
|
|
"""
|
|
Run all tests for the ``rattail.pyramid`` package.
|
|
|
|
Unfortunately we can't just run ``nosetests --with-cover``, because there
|
|
doesn't seem to be any way to prevent the ``pkg_resources`` API from
|
|
initializing. When this happens, ``rattail`` is imported because of its
|
|
being a namespace package. But...it gets imported before ``coverage``
|
|
starts, which means that we can't get a true measure of coverage.
|
|
|
|
Oh, the humanity...
|
|
"""
|
|
|
|
cov = coverage.coverage(source=['rattail.pyramid'])
|
|
cov.start()
|
|
|
|
if sys.platform == 'win32':
|
|
cov.exclude(r'# pragma: win32 no cover$')
|
|
|
|
# Must import this *after* coverage has started.
|
|
import nose
|
|
nose.run(argv=[''])
|
|
|
|
cov.stop()
|
|
cov.save()
|
|
|
|
modules = [
|
|
'rattail.pyramid',
|
|
]
|
|
modules = [sys.modules[x] for x in modules]
|
|
|
|
cov.html_report(modules, directory='htmlcov')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
runtests()
|