From 8ef2cfa364aa174f87c8f0f084446086ef0682f3 Mon Sep 17 00:00:00 2001 From: Jason Hu Date: Mon, 6 Aug 2018 01:51:37 -0700 Subject: [PATCH] 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 --- .travis.yml | 4 ++-- tox.ini | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0a3d710810c..920e8b57047 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/tox.ini b/tox.ini index fb36ac6511a..d6ef1981bef 100644 --- a/tox.ini +++ b/tox.ini @@ -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 =