From 757d47e1c09a0f17066c003a13a0c4a48cc401b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=20V=C3=AEjdea?= Date: Fri, 12 Jan 2018 03:35:36 +0100 Subject: [PATCH] Add py3-django111 testing combination Tests are also now run in parallel using detox and pytest-xdist. --- .coveragerc | 5 ++++- .travis.yml | 24 ++++++++++++++++-------- requirements/dev.txt | 1 - requirements/test.txt | 1 + requirements/tox.txt | 1 + tox.ini | 8 +++----- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.coveragerc b/.coveragerc index 30e8e4c..049126f 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,6 +1,8 @@ [run] source = drf_yasg branch = True +parallel = true +disable_warnings = module-not-measured [report] # Regexes for lines to exclude from consideration @@ -29,7 +31,8 @@ exclude_lines = raise SwaggerGenerationError ignore_errors = True -precision = 0 +precision = 2 +show_missing = True [paths] source = diff --git a/.travis.yml b/.travis.yml index d39302e..b2b2aeb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,31 +2,31 @@ language: python cache: pip python: + - '2.7' - '3.4' - '3.5' - '3.6' env: - - DRF=3.7 DJANGO=2.0 + - DRF=3.7 jobs: include: - stage: test - python: '2.7' - env: DRF=3.7 DJANGO=1.11 + python: '3.6' + env: DRF=master - python: '3.5' env: TOXENV=docs - python: '2.7' env: TOXENV=lint - - - python: '3.6' - env: DRF=master - stage: publish python: '3.6' + before_script: skip script: skip + after_success: skip env: deploy: &pypi provider: pypi @@ -48,12 +48,20 @@ install: before_script: - coverage erase + - | + [[ -z "$TOXENV" ]] && REPORT_COVERAGE="yes" || REPORT_COVERAGE="no"; + echo "Reporting coverage: ${REPORT_COVERAGE}" + - | + [[ -z "$TOXENV" && ! -z "$DRF" && "$DRF" != "master" ]] && USE_DETOX="yes" || USE_DETOX="no"; + echo "Using detox: ${USE_DETOX}" script: - - tox + - 'if [[ "$USE_DETOX" == "yes" ]]; then detox; else tox; fi' after_success: - - codecov + - coverage combine + - 'if [[ "$REPORT_COVERAGE" == "yes" ]]; then coverage report; fi' + - 'if [[ "$REPORT_COVERAGE" == "yes" ]]; then codecov; fi' branches: only: diff --git a/requirements/dev.txt b/requirements/dev.txt index d3b2a9e..8a866e0 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -4,4 +4,3 @@ -r lint.txt tox-battery>=0.5 -detox>=0.11 diff --git a/requirements/test.txt b/requirements/test.txt index 5f1b464..4a1cc9d 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -2,6 +2,7 @@ pytest>=2.9 pytest-pythonpath>=0.7.1 pytest-cov>=2.5.1 +pytest-xdist>=1.22.0 # latest pip version of pytest-django is more than a year old and does not support Django 2.0 git+https://github.com/pytest-dev/pytest-django.git@94cccb956435dd7a719606744ee7608397e1eafb datadiff==2.0.0 diff --git a/requirements/tox.txt b/requirements/tox.txt index 29119f6..f1661a0 100644 --- a/requirements/tox.txt +++ b/requirements/tox.txt @@ -1,4 +1,5 @@ # requirements for building and running tox tox>=2.9.1 +detox>=0.11 -r setup.txt diff --git a/tox.ini b/tox.ini index 3dcff02..989b93a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = py27-django111-drf37, - py{34,35,36}-django20-drf37, + py{34,35,36}-django{111,20}-drf37, py36-drfmaster, lint, docs @@ -9,9 +9,6 @@ envlist = DRF = 3.7: drf37 master: drfmaster -DJANGO = - 1.11: django111 - 2.0: django20 [testenv] deps = @@ -29,7 +26,7 @@ deps = -rrequirements/test.txt commands = - pytest --cov-config .coveragerc --cov-append --cov {posargs} + pytest --cov --cov-config .coveragerc --cov-append --cov-report="" {posargs} [testenv:py36-drfmaster] pip_pre = True @@ -51,6 +48,7 @@ commands = [pytest] DJANGO_SETTINGS_MODULE = testproj.settings.local python_paths = testproj +addopts = -n 3 [flake8] max-line-length = 120