Skip to content

Commit

Permalink
Fixed runtests to support coverage with travis.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoppert committed Jun 11, 2014
1 parent a62a3c6 commit 1bfc4db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ install:
- kill $msg_pid

# command to run tests
script: runtests.py --coverage
script: python runtests.py --coverage
after_success:
- coveralls
10 changes: 8 additions & 2 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ def main(argv):
help="just build, do not run any tests")
parser.add_argument("--doctests", action="store_true", default=False,
help="Run doctests in module")
parser.add_argument("--coverage", action="store_true", default=False,
parser.add_argument("--coverage_html", action="store_true", default=False,
help=("report coverage of project code. HTML output goes "
"under build/coverage"))
parser.add_argument("--coverage", action="store_true", default=False,
help=("report coverage of project code."))
parser.add_argument("--gcov", action="store_true", default=False,
help=("enable C code coverage via gcov (requires GCC). "
"gcov output goes to build/**/*.gc*"))
Expand Down Expand Up @@ -153,14 +155,18 @@ def main(argv):
os.execv(shell, [shell] + extra_argv)
sys.exit(1)

if args.coverage:
if args.coverage_html:
dst_dir = os.path.join(ROOT_DIR, 'build', 'coverage')
fn = os.path.join(dst_dir, 'coverage_html.js')
if os.path.isdir(dst_dir) and os.path.isfile(fn):
shutil.rmtree(dst_dir)
extra_argv += ['--cover-html',
'--cover-html-dir='+dst_dir]

if args.coverage:
extra_argv += ['--cover-erase', '--with-coverage',
'--cover-package=slycot']

test_dir = os.path.join(ROOT_DIR, 'build', 'test')

if args.build_only:
Expand Down

0 comments on commit 1bfc4db

Please sign in to comment.