mirror of https://github.com/zulip/zulip.git
Generate mypy coverage report for travis + coveralls.
This commit is contained in:
parent
04e2745136
commit
0b7852f081
|
@ -0,0 +1,2 @@
|
|||
service_name: travis-pro
|
||||
repo_token: hnXUEBKsORKHc8xIENGs9JjktlTb2HKlG
|
18
.travis.yml
18
.travis.yml
|
@ -1,6 +1,7 @@
|
|||
before_install:
|
||||
- nvm install 0.10
|
||||
install:
|
||||
- pip install coveralls
|
||||
- tools/travis/setup-$TEST_SUITE
|
||||
- tools/clean-venv-cache --travis
|
||||
cache:
|
||||
|
@ -9,10 +10,15 @@ cache:
|
|||
- $HOME/phantomjs
|
||||
- $HOME/zulip-venv-cache
|
||||
env:
|
||||
- TEST_SUITE=frontend
|
||||
- TEST_SUITE=backend
|
||||
- TEST_SUITE=production
|
||||
- TEST_SUITE=py3k
|
||||
global:
|
||||
- COVERALLS_PARALLEL=true
|
||||
- COVERALLS_SERVICE_NAME=travis-pro
|
||||
- COVERALLS_REPO_TOKEN=hnXUEBKsORKHc8xIENGs9JjktlTb2HKlG
|
||||
matrix:
|
||||
- TEST_SUITE=frontend
|
||||
- TEST_SUITE=backend
|
||||
- TEST_SUITE=production
|
||||
- TEST_SUITE=py3k
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
|
@ -28,3 +34,7 @@ services:
|
|||
- docker
|
||||
addons:
|
||||
postgresql: "9.3"
|
||||
after_success:
|
||||
coveralls
|
||||
notifications:
|
||||
webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN
|
||||
|
|
|
@ -36,8 +36,8 @@ parser.add_argument('-m', '--modified', action='store_true', default=False, help
|
|||
parser.add_argument('-a', '--all', dest='all', action='store_true', default=False,
|
||||
help="""run mypy on all python files, ignoring the exclude list.
|
||||
This is useful if you have to find out which files fail mypy check.""")
|
||||
parser.add_argument('--linecount-report', dest='linecount_report', action='store_true', default=False,
|
||||
help="""run the linecount report to see annotation coverage""")
|
||||
parser.add_argument('--linecoverage-report', dest='linecoverage_report', action='store_true', default=False,
|
||||
help="""run the linecoverage report to see annotation coverage""")
|
||||
parser.add_argument('--disallow-untyped-defs', dest='disallow_untyped_defs', action='store_true', default=False,
|
||||
help="""throw errors when functions are not annotated""")
|
||||
args = parser.parse_args()
|
||||
|
@ -58,9 +58,9 @@ else:
|
|||
mypy_command = "mypy"
|
||||
|
||||
extra_args = ["--fast-parser", "--silent-imports", "--py2", "--check-untyped-defs"]
|
||||
if args.linecount_report:
|
||||
extra_args.append("--linecount-report")
|
||||
extra_args.append("linecount-report")
|
||||
if args.linecoverage_report:
|
||||
extra_args.append("--linecoverage-report")
|
||||
extra_args.append("linecoverage-report")
|
||||
if args.disallow_untyped_defs:
|
||||
extra_args.append("--disallow-untyped-defs")
|
||||
|
||||
|
@ -68,6 +68,13 @@ if args.disallow_untyped_defs:
|
|||
# run mypy
|
||||
if python_files:
|
||||
rc = subprocess.call([mypy_command] + extra_args + python_files)
|
||||
if args.linecoverage_report:
|
||||
# Move the coverage report to where coveralls will look for it.
|
||||
try:
|
||||
os.rename('linecoverage-report/coverage.txt', '.coverage')
|
||||
except OSError:
|
||||
# maybe mypy crashed; exit with its error code
|
||||
pass
|
||||
sys.exit(rc)
|
||||
else:
|
||||
print("There are no files to run mypy on.")
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
six==1.10.0
|
||||
git+https://github.com/python/mypy.git@e1c5a255877cf817eda525466b0d33f8bc4e50b3
|
||||
git+https://github.com/rwbarton/mypy.git@3f4497689636cc9eea44239ba3ab73f1f5c7aaa6
|
||||
typed-ast==0.5.2
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo '+ ./tools/run-mypy'
|
||||
./tools/run-mypy
|
||||
echo '+ ./tools/run-mypy --linecoverage-report'
|
||||
./tools/run-mypy --linecoverage-report
|
||||
retcode="$?"
|
||||
|
||||
if [ "$retcode" == "0" ]; then
|
||||
|
|
Loading…
Reference in New Issue