py-twisted/tox.ini

167 lines
6.1 KiB
INI

; tox configuration file for running tests similar to buildbot builders.
;
; The main trial based environments are defined based on a set of tags. Each
; tag will trigger a different behavior. Multiple tags can be set for the same environment:
;
; * alldeps - install all possible dependencies.
; * nodeps - avoid installing any dependency.
; * withcov - run the tests wrapped using the coverage.
; * nocov - run the tests directly, without using the coverage wrapper.
; * wheel - build the wheel distribution
; * posix - prepare the tests to be run in a Linux/Unix/macOS environment.
; * macos - prepare the tests to be run in a macOS 10.11+ environment (superset of posix)
; * macos1010 - prepare the tests to be run in a macOS 10.10 environment (superset of posix)
; * windows - prepare the tests to be executed under Windows.
;
; Some tags are defined only while transitioning to an updated Buildbot and
; should be removed after the transition.
; See: https://github.com/twisted-infra/braid/issues/222
;
; * tests - similar to alldeps
; * coverage - similar to withcov and alldeps
; * nomodules - similar to nodeps
;
; There is a non-default `codecov-publish` environment used to publish the
; coverage results to codecov.io. It should be called after running the
; standard coverage environment.
;
; A non-default `txchecker-travis` environment is used to run twistedchecker
; on travis in --diff mode
;
[tox]
minversion=2.4
skip_missing_interpreters=True
toxworkdir=build/
envlist=
{py27,py33,py34,py35,py36}-{alldeps,nodeps}-{withcov,nocov}-{posix,macos,macos1010,windows}
{py27,py36}-wheel
pyflakes,twistedchecker,apidocs,narrativedocs,newsfragment,manifest-checker
[testenv]
;; dependencies managed by extras in t.p._setup.py._EXTRAS_REQUIRE
extras =
{alldeps,tests,coverage}: all_non_platform
windows: windows_platform
{alldeps,tests}-macos: osx_platform
; Documentation needs Twisted install to get the version.
narrativedocs: dev
;; dependencies that are not specified as extras
deps =
py27-{alldeps,tests,coverage}-{posix,macos}: pysqlite
{withcov,coverage}: coverage
codecov-publish: codecov==2.0.5
wheel: wheel
; Code quality checkers
pyflakes{,3}: pyflakes
manifest-checker: check-manifest
; We go with unreleased version as PyPI version is 1 year old.
; Also, I hope that the Twisted blank_lines will be supported soon upstream
; and also released soon on PyPI, so that we no longer have to use a
; commit.
{pycodestyle,pycodestylediff}: https://github.com/pycqa/pycodestyle/archive/eb91b79ab38aad4d44a3b52b02605412f32ba5ae.zip
{twistedchecker,txchecker-travis}: twistedchecker>=0.7.1
txchecker-travis: diff-cover==0.9.12
; All environment variables are passed.
passenv = *
setenv =
; Enable sub-processes coverage reports and store coverage reports in a
; known location.
COVERAGE_PROCESS_START = {toxinidir}/.coveragerc
COVERAGE_FILE = {toxinidir}/.coverage
# Help tests know where the base directory is.
TOX_INI_DIR = {toxinidir}
; Skip twistedchecker warnings that are not yet required in the required run
txchecker-travis-required: TWISTEDCHECKER_SKIP_WARNINGS = W9208,C0302,C0103,C9302
commands =
;
; Display information about Python interpreter
; which will be used in subsequent steps
;
python -c "import sys; print(sys.prefix)"
python -c "import sys; print(sys.exec_prefix)"
python -c "import sys; print(sys.executable)"
python --version
; Install PyDoctor here so it DOESNT overwrite Twisted
apidocs: pip install --no-deps epydoc pydoctor
; Run tests without wrapping them using coverage.
{nocov,nomodules,tests}: python -m twisted.trial --reactor={env:TWISTED_REACTOR:default} --reporter={env:TRIAL_REPORTER:verbose} {posargs:twisted}
; Run the tests wrapped using coverage.
{withcov,coverage}: python {toxinidir}/admin/_copy.py {toxinidir}/admin/zz_coverage.pth {envsitepackagesdir}/zz_coverage.pth
{withcov,coverage}: coverage erase
{withcov,coverage}: coverage run -p --rcfile={toxinidir}/.coveragerc -m twisted.trial --reactor={env:TWISTED_REACTOR:default} --reporter={env:TRIAL_REPORTER:verbose} {posargs:twisted}
; Publish the coverage reports to codecov.io
codecov-publish: coverage combine
codecov-publish: coverage xml -o coverage.xml -i
codecov-publish: codecov {env:CODECOV_OPTIONS:} -X search -X gcov -f coverage.xml
; Build in a root folder so that buildbot can pick the result
wheel: python setup.py bdist_wheel --dist-dir {toxinidir}/dist
twistedchecker: twistedchecker src/{posargs:twisted}
txchecker-travis: {toxinidir}/.travis/twistedchecker-trunk-diff.sh {posargs:twisted}
pyflakes: pyflakes {posargs:src/twisted admin bin}
pyflakes3: /bin/sh -c "pyflakes $(find src/twisted admin bin \! -name "compat.py" \! -name "test_compat.py" \! -name "dict.py" -name '*.py' -o -name '*.3only')"
apidocs: {toxinidir}/bin/admin/build-apidocs {toxinidir}/src/ apidocs
narrativedocs: sphinx-build -aW -b html -d {toxinidir}/docs/_build {toxinidir}/docs {toxinidir}/docs/_build/
newsfragment: python {toxinidir}/bin/admin/check-newsfragment "{toxinidir}"
manifest-checker: check-manifest --ignore "docs/_build*,docs/historic/*,admin*,bin/admin*,twisted/topfiles/*.Old"
pycodestyle: python {toxinidir}/admin/pycodestyle-twisted.py {posargs:admin src/twisted}
; Travis-CI version is executing in diff mode without any input arguments.
pycodestylediff: /bin/sh -c "git diff trunk | python {toxinidir}/admin/pycodestyle-twisted.py --diff"
[testenv:pyflakes]
basepython=python2.7
# Static checkers don't need to install the source code.
skip_install = true
[testenv:pyflakes3]
basepython=python3.6
# Static checkers don't need to install the source code.
skip_install = true
[testenv:apidocs]
# Epydoc and pydoctor currently on work on Python 2
basepython=python2.7
[testenv:manifest-checker]
skip_install = true
[testenv:pycodestyle]
skip_install = true
[testenv:pycodestylediff]
skip_install = true
# TwistedChecker needs to be 3.5
[testenv:twistedchecker]
basepython=python3.5
# TwistedChecker needs to be 3.5
[testenv:txchecker-travis-required]
basepython=python3.5
usedevelop=True