Add Jython coverage support. Thanks to @testInord. https://github.com/baztian/jaydebeapi/pull/17#issuecomment-275192869
parent
8fc9ae8869
commit
47aa0c68a3
|
|
@ -4,16 +4,25 @@
|
||||||
http://stackoverflow.com/a/33012308/1960601
|
http://stackoverflow.com/a/33012308/1960601
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
|
import pickle
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
|
|
||||||
|
def convert_old_coverage_to_new(filename):
|
||||||
|
with open(filename, "rb") as inp_file:
|
||||||
|
coverage_results = pickle.load(inp_file)
|
||||||
|
main_results ={"lines": coverage_results['lines']}
|
||||||
|
with open(".coverage","w") as out_file:
|
||||||
|
out_file.write("!coverage.py: This is a private format,"
|
||||||
|
"don't read it directly!")
|
||||||
|
out_file.write(json.dumps(main_results))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if sys.platform.lower().startswith('java'):
|
if sys.platform.lower().startswith('java'):
|
||||||
print("Export to coveralls skipped for Jython")
|
convert_old_coverage_to_new(".coverage")
|
||||||
sys.exit(0)
|
|
||||||
if 'TRAVIS' in os.environ:
|
if 'TRAVIS' in os.environ:
|
||||||
rc = call('coveralls')
|
rc = call('coveralls')
|
||||||
raise SystemExit(rc)
|
raise SystemExit(rc)
|
||||||
|
|
|
||||||
1
tox.ini
1
tox.ini
|
|
@ -23,6 +23,7 @@ deps =
|
||||||
py26: unittest2==0.5.1
|
py26: unittest2==0.5.1
|
||||||
# urllib3 required by coveralls. See https://github.com/eddyxu/cpp-coveralls/issues/108
|
# urllib3 required by coveralls. See https://github.com/eddyxu/cpp-coveralls/issues/108
|
||||||
py26: urllib3[secure]
|
py26: urllib3[secure]
|
||||||
|
jython-driver: coverage==3.7.1
|
||||||
py: JPype1==0.6.2
|
py: JPype1==0.6.2
|
||||||
jip==0.9.10
|
jip==0.9.10
|
||||||
coveralls
|
coveralls
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue