diff --git a/.coveragerc b/.coveragerc index 3e04b511d..646b5062a 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,4 @@ [run] parallel = true -source = pytest_django +source = pytest_django,pytest_django_test,tests branch = true diff --git a/.travis.yml b/.travis.yml index 89d3ca275..b71def9f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ language: python matrix: fast_finish: true include: - - python: 3.6 env: TOXENV=py36-pytest3-djangomaster-postgres - python: 3.6 @@ -70,12 +69,31 @@ install: - printf '\necho "Using pip-wrapper.." >&2\ntravis_retry pip "$@"' >> bin/travis_retry_pip - chmod +x bin/travis_retry_pip - sed -i.bak 's/^\[testenv\]/\0\ninstall_command = travis_retry_pip install {opts} {packages}/' tox.ini - - diff tox.ini tox.ini.bak && return 1 || true - - sed -i.bak 's/whitelist_externals =/\0\n travis_retry_pip/' tox.ini - - diff tox.ini tox.ini.bak && return 1 || true + - if diff tox.ini tox.ini.bak; then exit 1; fi + - printf '\nwhitelist_externals = travis_retry_pip' >> tox.ini - pip install tox==2.7.0 + - | + if [[ "${TOXENV%-checkqa}" == "$TOXENV" ]]; then + export PYTEST_ADDOPTS='--cov=pytest_django --cov=tests --cov=pytest_django_test --cov-report=term-missing:skip-covered' + export _PYTESTDJANGO_TOX_EXTRA_DEPS=pytest-cov + fi script: - tox - "find ${TRAVIS_BUILD_DIR}/.tox -name 'log' -o -name '__pycache__' -type d | xargs -I {} rm -rf {}" + +after_success: + - | + set -ex + if [[ "${TOXENV%-checkqa}" == "$TOXENV" ]]; then + pip install codecov + coverage combine + coverage xml + coverage report -m --skip-covered + + codecov_flags=${TOXENV//./} + codecov_flags=${codecov_flags//-/ } + codecov --required -X search gcov pycov -f coverage.xml --flags $codecov_flags + fi + set +x diff --git a/tox.ini b/tox.ini index 9e1fd149a..13b5122f9 100644 --- a/tox.ini +++ b/tox.ini @@ -14,6 +14,7 @@ envlist = deps = django-configurations==2.0 pytest-xdist==1.15 + {env:_PYTESTDJANGO_TOX_EXTRA_DEPS:} checkqa: flake8 @@ -31,17 +32,15 @@ deps = pytest2: pytest>=2.9,<3.0 pytest3: pytest>=3.0,<4.0 - setenv = PYTHONPATH = {toxinidir}:{env:PYTHONPATH:} - +passenv = PYTEST_ADDOPTS usedevelop = True - commands = checkqa: flake8 --version checkqa: flake8 --show-source --statistics {posargs:pytest_django pytest_django_test} - mysql_innodb: py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} - mysql_myisam: py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} - postgres: py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} - sqlite: py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} - sqlite_file: py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} + mysql_innodb: pytest --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} + mysql_myisam: pytest --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} + postgres: pytest --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} + sqlite: pytest --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} + sqlite_file: pytest --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests}