diff --git a/.gitignore b/.gitignore index b7ab98b..97704fe 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,6 @@ target/ .classpath .project .tox +.coverage *.iml .idea/ diff --git a/ci/run_coveralls.py b/ci/run_coveralls.py new file mode 100644 index 0000000..6bbf61d --- /dev/null +++ b/ci/run_coveralls.py @@ -0,0 +1,15 @@ +#!/bin/env/python + +"""Runs coveralls if in Travis CI build environment. Taken from +http://stackoverflow.com/a/33012308/1960601 +""" + +import os + +from subprocess import call + + +if __name__ == '__main__': + if 'TRAVIS' in os.environ: + rc = call('coveralls') + raise SystemExit(rc) diff --git a/tox.ini b/tox.ini index b7773c6..cbcbe8a 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,7 @@ python = [testenv] whitelist_externals = mvn +passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH setenv = CLASSPATH = {envdir}/javalib/* driver-mock: TESTNAME=test_mock @@ -20,6 +21,7 @@ deps = py26: unittest2==0.5.1 py: JPype1==0.6.2 jip==0.9.10 + coveralls commands = python --version python ci/jipconf_subst.py {envdir} {toxworkdir}/shared @@ -27,5 +29,6 @@ commands = driver-sqliteXerial: jip install org.xerial:sqlite-jdbc:3.7.2 driver-mock: mvn -Dmaven.repo.local={toxworkdir}/shared/.m2/repository -f mockdriver/pom.xml install driver-mock: jip install org.jaydebeapi:mockdriver:1.0-SNAPSHOT - {envbindir}/python test/testsuite.py {env:TESTNAME} - driver-hsqldb: {envbindir}/python test/doctests.py + coverage run --source {envsitepackagesdir}/jaydebeapi test/testsuite.py {env:TESTNAME} + driver-hsqldb: coverage run -a --source {envsitepackagesdir}/jaydebeapi test/doctests.py + python ci/run_coveralls.py