Skip to content

Commit 2e5cc7c

Browse files
committed
move all DEV dependencies to setup.py, optimize CI
- move fix lint to Travis (faster) - make sure all coverage data stays in tox work directory - remove codecov token on AppVeyor (need to pass TOXENV, and other env variables)
1 parent 9bbcabd commit 2e5cc7c

File tree

4 files changed

+88
-65
lines changed

4 files changed

+88
-65
lines changed

.travis.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
sudo: false
22
language: python
3-
cache: python
3+
cache: pip
44
python:
55
- 2.7
66
- 3.4
@@ -9,6 +9,8 @@ python:
99
- 3.7-dev
1010
- nightly
1111
- pypy
12+
env:
13+
TOXENV=py
1214

1315
matrix:
1416
fast_finish: true
@@ -17,15 +19,24 @@ matrix:
1719
- python: nightly
1820
- python: pypy
1921
include:
20-
- os: osx
21-
language: generic
22+
- python: 3.6
23+
env: TOXENV=docs
24+
- python: 3.6
25+
env: TOXENV=fix-lint
26+
- os: osx
27+
language: generic
2228

2329
before_install:
2430
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source .travis-osx; fi
2531
# work around https://github.com/travis-ci/travis-ci/issues/8363
2632
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then pyenv global system 3.5; fi
27-
install: pip install -U six && pip install --pre -U tox
28-
script: tox -e py
33+
34+
install:
35+
- pip install -U six
36+
- pip install --pre -U tox
37+
38+
script:
39+
- tox
40+
2941
after_success:
30-
- tox -e coverage
31-
- tox -e codecov
42+
- if [[ $TOXENV == "py" ]]; then tox -e coverage,codecov; fi

appveyor.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
build: false # Not a C# project
12
environment:
23
matrix:
3-
- TOXENV: fix-lint
44
- TOXENV: py27
55
- TOXENV: py34
66
- TOXENV: py35
@@ -9,12 +9,14 @@ environment:
99
matrix:
1010
fast_finish: true
1111

12-
build: false # Not a C# project
13-
install: C:\Python36\python -m pip install --pre -U tox
14-
test_script: C:\Python36\scripts\tox
12+
install:
13+
- C:\Python36\python -m pip install --pre -U tox
14+
15+
test_script:
16+
- C:\Python36\scripts\tox
17+
1518
after_test:
16-
- if exist .tox\.coverage.* (C:\Python36\scripts\tox -e coverage) else (echo no .coverage files)
17-
- if exist .tox\coverage.xml (C:\Python36\scripts\tox -e codecov) else (echo no coverage.xml)
19+
- C:\Python36\scripts\tox -e coverage,codecov
1820

1921
cache:
2022
- '%LOCALAPPDATA%\pip\cache'

setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ def main():
5050
'pluggy>=0.3.0,<1.0',
5151
'six',
5252
'virtualenv>=1.11.2'],
53+
extras_require={'testing': ['pytest >= 3.0.0',
54+
'pytest-cov',
55+
'pytest-timeout',
56+
'pytest-xdist'],
57+
'docs': ['sphinx >= 1.6.3, < 2',
58+
'towncrier >= 17.8.0'],
59+
'lint': ['flake8 == 3.4.1',
60+
'flake8-bugbear == 17.4.0',
61+
'pre-commit == 1.3.0'],
62+
'publish': ['devpi',
63+
'twine']},
5364
classifiers=['Development Status :: 5 - Production/Stable',
5465
'Intended Audience :: Developers',
5566
'License :: OSI Approved :: MIT License',

tox.ini

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,94 @@
11
[tox]
2-
envlist = py27,py34,py35,py36,pypy,style,docs
3-
minversion = 2.7.0
2+
envlist = py27,
3+
py34,
4+
py35,
5+
py36,
6+
pypy,
7+
coverage,
8+
fix-lint,
9+
docs
10+
minversion = 2.9.0
11+
skip_missing_interpreters = true
412

513
[testenv]
6-
description = run the unit tests with pytest under the current Python env
14+
description = run the unit tests with pytest under {basepython}
715
setenv = COVERAGE_FILE={toxworkdir}/.coverage.{envname}
8-
passenv = http_proxy https_proxy no_proxy SSL_CERT_FILE CI TRAVIS TRAVIS_*
9-
deps = pytest >= 3.0.0
10-
pytest-cov
11-
pytest-timeout
12-
pytest-xdist
13-
;NOTE --cov-config={toxinidir}/tox.ini is necessary until
14-
;https://github.com/pytest-dev/pytest-cov/issues/168 is fixed
15-
commands = pytest {posargs:tests} --cov-config="{toxinidir}/tox.ini" --cov="{envsitepackagesdir}/tox" --timeout=180
16-
17-
[testenv:dev]
18-
description = DEV environment, if no posarg is specified: run pytest
19-
# required to make looponfail reload on every source code change
20-
usedevelop = True
21-
commands = {posargs:py.test -s -x -f -v}
16+
passenv = http_proxy https_proxy no_proxy SSL_CERT_FILE TOXENV CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_*
17+
extras = testing
18+
commands = pytest {posargs:--cov-config={toxinidir}/tox.ini --cov={envsitepackagesdir}/tox --timeout=180 tests}
2219

2320
[testenv:docs]
2421
description = invoke sphinx-build to build the HTML docs, check that URIs are valid
2522
basepython = python3.6
26-
deps = sphinx >= 1.6.3, < 2
27-
towncrier >= 17.8.0
28-
{[testenv]deps}
29-
commands = sphinx-build -d "{toxworkdir}/docs_doctree" doc "{toxworkdir}/docs_out" --color -W -bhtml
30-
sphinx-build -d "{toxworkdir}/docs_doctree" doc "{toxworkdir}/docs_out" --color -W -blinkcheck
23+
extras = docs
24+
commands = sphinx-build -d {toxworkdir}/docs_doctree doc {toxworkdir}/docs_out --color -W -bhtml
25+
sphinx-build -d {toxworkdir}/docs_doctree doc {toxworkdir}/docs_out --color -W -blinkcheck
3126

3227
[testenv:fix-lint]
3328
basepython = python3.6
3429
passenv = {[testenv]passenv}
3530
HOMEPATH
36-
deps = flake8 == 3.4.1
37-
flake8-bugbear == 17.4.0
38-
pre-commit == 1.3.0
31+
extras = lint
3932
description = run static analysis and style check using flake8
4033
commands = python -m flake8 --show-source tox setup.py {posargs}
4134
python -m flake8 --show-source doc tests {posargs}
4235
pre-commit run --all-files
43-
echo "hint: run {envdir}/bin/pre-commit install" to add checks as pre-commit hook
36+
python -c 'print("hint: run {envdir}/bin/pre-commit install to add checks as pre-commit hook")'
4437

45-
[flake8]
46-
max-complexity = 22
47-
max-line-length = 99
48-
49-
[testenv:X]
50-
description = print the positional arguments passed in with echo
51-
commands = echo {posargs}
5238

5339
[testenv:coverage]
54-
description = [run locally after tests]: combine coverage data and create reports
55-
skip_install = True
56-
setenv = COVERAGE_FILE={toxworkdir}/.coverage
40+
description = combine coverage data and create reports
5741
deps = coverage
42+
skip_install = True
43+
changedir = {toxworkdir}
44+
setenv = COVERAGE_FILE=.coverage
5845
commands = coverage erase
5946
coverage combine
47+
coverage report --rcfile={toxinidir}/tox.ini
6048
coverage xml
61-
coverage html
6249

6350
[testenv:codecov]
64-
description = [only run on CI]: upload coverage data to codecov
65-
;NOTE token should not be necesssary but seems to be on appveyor
66-
setenv = {[testenv:coverage]setenv}
67-
CODECOV_TOKEN = 01eb408d-0640-4527-a5f6-9dfe30f9f2ba
51+
description = [only run on CI]: upload coverage data to codecov (depends on coverage running first)
6852
deps = codecov
69-
commands = codecov --required
53+
skip_install = True
54+
commands = codecov --file {toxworkdir}/coverage.xml
7055

7156
[testenv:pra]
7257
passenv = *
7358
description = "personal release assistant" - see HOWTORELEASE.rst
74-
skip_install = True
75-
deps = devpi
76-
towncrier
77-
twine
78-
commands = "{toxinidir}/tasks/pra.sh" {posargs}
59+
extras = publish, docs
60+
commands = {toxinidir}/tasks/pra.sh {posargs}
61+
62+
[testenv:X]
63+
description = print the positional arguments passed in with echo
64+
commands = echo {posargs}
65+
66+
[testenv:dev]
67+
description = generate a DEV environment
68+
extras = testing, docs, lint
69+
# required to make looponfail reload on every source code change
70+
usedevelop = True
71+
commands = python -m pip list --format=columns
72+
python -c 'import sys; print(sys.executable)'
73+
74+
[flake8]
75+
max-complexity = 22
76+
max-line-length = 99
7977

8078
[coverage:run]
81-
branch = True
82-
source = tox
8379
omit = tox/__main__.py
8480

81+
[coverage:report]
82+
skip_covered = True
83+
show_missing = True
84+
exclude_lines = if __name__ == ["']__main__["']:
85+
8586
[coverage:paths]
8687
source = tox
8788
{toxworkdir}/*/lib/python*/site-packages/tox
89+
{toxworkdir}/*/Lib/site-packages/tox
8890
{toxworkdir}/pypy*/site-packages/tox
8991
90-
[coverage:report]
91-
exclude_lines = if __name__ == ["']__main__["']:
92-
9392
[pytest]
9493
addopts = -rsxX
9594
rsyncdirs = tests tox

0 commit comments

Comments
 (0)