Try to fix coveralls unstable result (#15800)

* Create one tox env for code coverage report

pytest-cov generated report in project root folder, not tox env folder.

* Add cov tox env to travis

* Coveralls seems expecting all build jobs upload

* Only upload coverage after cov env success
pull/15857/head
Jason Hu 2018-08-06 01:51:37 -07:00 committed by Paulus Schoutsen
parent 12e69202f8
commit 8ef2cfa364
2 changed files with 19 additions and 3 deletions

View File

@ -13,7 +13,8 @@ matrix:
- python: "3.5.3"
env: TOXENV=typing
- python: "3.5.3"
env: TOXENV=py35
env: TOXENV=cov
after_success: coveralls
- python: "3.6"
env: TOXENV=py36
- python: "3.7"
@ -45,4 +46,3 @@ deploy:
on:
branch: dev
condition: $TOXENV = lint
after_success: coveralls

18
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
envlist = py35, py36, py37, py38, lint, pylint, typing
envlist = py35, py36, py37, py38, lint, pylint, typing, cov
skip_missing_interpreters = True
[testenv]
@ -11,6 +11,22 @@ setenv =
; fail.
whitelist_externals = /usr/bin/env
install_command = /usr/bin/env LANG=C.UTF-8 pip install {opts} {packages}
commands =
pytest --timeout=9 --duration=10 {posargs}
deps =
-r{toxinidir}/requirements_test_all.txt
-c{toxinidir}/homeassistant/package_constraints.txt
[testenv:cov]
basepython = {env:PYTHON3_PATH:python3}
setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/homeassistant
; both temper-python and XBee modules have utf8 in their README files
; which get read in from setup.py. If we don't force our locale to a
; utf8 one, tox's env is reset. And the install of these 2 packages
; fail.
whitelist_externals = /usr/bin/env
install_command = /usr/bin/env LANG=C.UTF-8 pip install {opts} {packages}
commands =
pytest --timeout=9 --duration=10 --cov --cov-report= {posargs}
deps =