New and better Travis config, sans Makefile and with Tox for pytests.

Groundwork for test coverage in pytests.
This commit is contained in:
Pavel Minaev 2018-11-18 00:11:21 -08:00 committed by Pavel Minaev
parent a8befaf680
commit 4176a5275c
5 changed files with 55 additions and 93 deletions

13
.coveragerc Normal file
View file

@ -0,0 +1,13 @@
[run]
branch = True
source = src
[report]
ignore_errors = True
exclude_lines =
if self.debug:
pragma: no cover
raise NotImplementedError
if __name__ == .__main__.:
omit =
src/ptvsd/_vendored/*

View file

@ -1,38 +1,38 @@
language: python
dist: xenial
sudo: required
cache: pip
python:
- "2.7"
- "3.4"
- "3.5-dev"
# 3.6 is tested via coverage
- "3.7-dev"
env:
- TARGET=ci-test
- "3.5"
- "3.6"
- "3.7"
matrix:
stages:
- lint
- test
jobs:
include:
- python: 3.6
env: TARGET=ci-lint
- python: "3.6-dev"
env: TARGET=ci-coverage
after_success:
- bash <(curl -s https://codecov.io/bash)
# The schema check is failing with a 403 error, possibly
# due to GitHub API limits.
#- python: 3.6
#- env: TARGET=ci-check-schemafile
before_install:
- export TRAVIS_PYTHON_PATH=`which python`
# Travis comes with an ancient version of pytest preinstalled globally,
# which breaks automatic dependency checks for setup.py. Force upgrade.
- $TRAVIS_PYTHON_PATH -m pip install --upgrade pip
- $TRAVIS_PYTHON_PATH -m pip install --upgrade pytest
- stage: lint
python: "3.7"
install:
- pip install -U pip setuptools flake8
script:
- flake8
install:
- make depends PYTHON=$TRAVIS_PYTHON_PATH
- pip install -U pip setuptools -r test_requirements.txt
script:
#- make $TARGET PYTHON=python$TRAVIS_PYTHON_VERSION
- make $TARGET PYTHON=$TRAVIS_PYTHON_PATH
- tox -- -vv
- |
if [[ $TRAVIS_PYTHON_VERSION != '2.7' ]]; then
pushd src
coverage run -m unittest discover -vv -s .. &&
popd
fi
after_success:
- bash <(curl -s https://codecov.io/bash); fi

View file

@ -1,56 +0,0 @@
PYTHON ?= python3
.PHONY: help
help: ## Print help about available targets.
@grep -h -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: depends
depends:
$(PYTHON) -m pip install --upgrade pip
$(PYTHON) -m pip install setuptools
$(PYTHON) -m pip install flake8_formatter_junit_xml
$(PYTHON) -m pip install unittest-xml-reporting
$(PYTHON) -m pip install --upgrade -r test_requirements.txt
.PHONY: lint
lint: ## Lint the Python source code.
#$(PYTHON) -m flake8 --ignore E24,E121,E123,E125,E126,E221,E226,E266,E704,E265,E501 --exclude ptvsd/pydevd $(CURDIR)
$(PYTHON) -m tests --lint-only
.PHONY: test
test: ## Run the test suite.
$(PYTHON) -m tests -v --full
.PHONY: test-quick
test-quick:
$(PYTHON) -m tests -v --quick
.PHONY: coverage
coverage: ## Check line coverage.
#$(PYTHON) -m coverage run --include 'ptvsd/*.py' --omit 'ptvsd/pydevd/*.py' -m tests
$(PYTHON) -m tests -v --full --coverage
.PHONY: check-schemafile
check-schemafile: ## Validate the vendored DAP schema file.
$(PYTHON) -m debugger_protocol.schema check
##################################
# CI
.PHONY: ci-lint
ci-lint: depends lint
.PHONY: ci-test
ci-test: depends
# For now we use --quickpy2.
$(PYTHON) -m tests -v --full --no-network --quick-py2
$(PYTHON) -m pytest -vv
.PHONY: ci-coverage
ci-coverage: depends
$(PYTHON) -m tests -v --full --coverage --no-network
.PHONY: ci-check-schemafile
ci-check-schemafile: check-schemafile

View file

@ -1,11 +1,13 @@
setuptools
colorama
coverage
django
requests
flask
django
pytest>=3.8
pytest-timeout>=1.3.2
psutil>=5.4
pygments>=2.2
colorama>=0.3
psutil
pygments
pytest
pytest-cov
pytest-timeout
setuptools
tox
tox-travis

11
tox.ini
View file

@ -1,7 +1,10 @@
[tox]
envlist=py27,py34,py35,py36,py37
envlist = py27,py34,py35,py36,py37
[testenv]
changedir=pytests
deps=-rtest_requirements.txt
commands=pytest -vv {posargs:}
changedir = pytests
deps = -rtest_requirements.txt
setenv =
COVERAGE_FILE = .coverage.{envname}
commands =
pytest {posargs:}