-
Notifications
You must be signed in to change notification settings - Fork 288
/
run_coveralls.py
34 lines (29 loc) · 1014 Bytes
/
run_coveralls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
# This file was cribbed from https://github.com/brechtm/citeproc-py
import os
from distutils.sysconfig import get_python_lib
from subprocess import call
if __name__ == '__main__':
# chdir to the site-packages directory so the report lists relative paths
orig_dir = os.getcwd()
dot_coverage_path = os.path.join(orig_dir, '.coverage')
os.chdir(get_python_lib())
try:
os.remove('.coverage')
except OSError:
pass
os.symlink(dot_coverage_path, '.coverage')
# create a report from the coverage data
if 'TRAVIS' in os.environ:
rc = call('coveralls')
raise SystemExit(0)
else:
rc = call(['coverage', 'report'])
raise SystemExit(rc)