From f4a5343040a7983efce1357477fc0b39dcae5761 Mon Sep 17 00:00:00 2001 From: Andrei Fokau Date: Wed, 25 Oct 2017 17:35:32 +0000 Subject: [PATCH] Add tox, coverage, flake8 and Travis config. --- .travis.yml | 34 ++++++++++++++++++++++++++++++++++ setup.cfg | 19 +++++++++++++++++++ tox.ini | 26 ++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 .travis.yml create mode 100644 setup.cfg create mode 100644 tox.ini diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..116ccd19 --- /dev/null +++ b/.travis.yml @@ -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 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..4bd241ef --- /dev/null +++ b/setup.cfg @@ -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__.: diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..40e162a3 --- /dev/null +++ b/tox.ini @@ -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