Add tox, coverage, flake8 and Travis config.

This commit is contained in:
Andrei Fokau 2017-10-25 17:35:32 +00:00
parent 23989a1c92
commit f4a5343040
No known key found for this signature in database
GPG Key ID: F2BC8AF1CE23A98E
3 changed files with 79 additions and 0 deletions

34
.travis.yml Normal file
View File

@ -0,0 +1,34 @@
sudo: false
language: python
cache: pip
# Tox cannot install pythons, so we set 3.5 as default, use 3.4 already
# available in container and then include 3.6 in matrix.
python:
- 3.5
env:
- TOXENV=py34
- TOXENV=py35
matrix:
include:
- python: 3.6
env: TOXENV=py36
- python: 3.4 # i.e. skip installing 3.5
env: TOXENV=lint
- python: 3.4
env: TOXENV=coverage
install:
- pip install tox
script:
- tox
after_success:
- if [[ $TOXENV =~ coverage ]]; then
pip install --quiet python-coveralls;
coveralls --ignore-errors;
fi

19
setup.cfg Normal file
View File

@ -0,0 +1,19 @@
[flake8]
exclude = .eggs,.tox,.git
max-line-length = 100
max-complexity = 14
[coverage:run]
source = telethon
#branch = True
parallel = True
[coverage:report]
ignore_errors = True
skip_covered = True
show_missing = True
# Regex expressions for lines excluded from report
exclude_lines =
pragma: no cover
if __name__ == .__main__.:

26
tox.ini Normal file
View File

@ -0,0 +1,26 @@
[tox]
envlist = py34,py35,py36
[testenv]
recreate = True
commands = coverage run setup.py test
install_command =
pip install {opts} {packages}
deps = coverage
[testenv:coverage]
basepython = python3.4
skip_install = true
commands =
coverage combine
coverage report
deps =
coverage
[testenv:lint]
basepython = python3.4
skip_install = true
commands =
flake8
deps =
flake8