diff --git a/.travis.yml b/.travis.yml index 708672f..09633e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,12 @@ python: install: - pip install --use-mirrors \ `python -c 'from setup import META; print " ".join(META["extras_require"]["testing"] + META["install_requires"])'` +- pip install coveralls +- python setup.py develop -script: make test +script: +- make remotes +- coverage run --source=tiddlywebplugins/bfw setup.py test +- coverage report -m + +after_success: coveralls diff --git a/README b/README index c29aeec..5042b3d 100644 --- a/README +++ b/README @@ -1,5 +1,6 @@ [Barely Functioning Wiki](https://github.com/FND/tiddlywebplugins.bfw) [![build status](https://secure.travis-ci.org/FND/tiddlywebplugins.bfw.png)](http://travis-ci.org/FND/tiddlywebplugins.bfw) +[![coverage](https://coveralls.io/repos/FND/tiddlywebplugins.bfw/badge.png)](https://coveralls.io/r/FND/tiddlywebplugins.bfw) wiki-like system for individuals and small teams, emphasizing micro-content and based on [TiddlyWeb](http://tiddlyweb.com) diff --git a/setup.py b/setup.py index 638c0a1..fdbb534 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,8 @@ +import sys import os from setuptools import setup, find_packages +from setuptools.command.test import test as TestCommand from tiddlywebplugins.bfw import (__version__ as VERSION, __author__ as AUTHOR, __license__ as LICENSE, __doc__ as DESC) @@ -32,5 +34,23 @@ } +# entry point for tests (required because `coverage` fails to invoke `py.test` +# in Travis CI's virtualenv) + +class PyTest(TestCommand): + + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = [] + self.test_suite = True + + def run_tests(self): + import pytest + errno = pytest.main(self.test_args) + sys.exit(errno) + +META['cmdclass'] = { 'test': PyTest } + + if __name__ == '__main__': setup(**META)