browbeat/tox.ini
Sorin Sbarnea 489300d832 Add pypi publishing testing
Builds the source and wheel distribution as part of linting job to
assure we can build the package.

Adds packaging temp files to .gitignore to avoid poluting the
repository.

Adds a publish tox environment which can be used for manual publishing
on pypi (exceptional cases).

Change-Id: If9176b33cc13904a516d8e64d53170f52f2baf55
2019-04-10 17:00:44 +00:00

96 lines
2.2 KiB
INI

[tox]
minversion = 2.0
envlist = py27,py35,py36,py37,linters,dist,insights
skipsdist = True
[testenv]
usedevelop = True
install_command = pip install -U {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
commands = python setup.py test
whitelist_externals =
bash
rm
[testenv:linters]
# py3 linters are able to stop more than py2 ones
basepython = python3
extras = insights
commands =
{[testenv:pep8]commands}
python -m pre_commit run -a
pykwalify -d browbeat-config.yaml -s browbeat/schema/browbeat.yml
pykwalify -d browbeat-complete.yaml -s browbeat/schema/browbeat.yml
bash -c "set -e; for config in $(ls conf/); do \
echo conf/$config; pykwalify -d conf/$config -s browbeat/schema/browbeat.yml; done"
{[testenv:dist]commands}
[testenv:dist]
basepython = python3
# reuse linters environment to lower footprint on dev machines
envdir = {toxworkdir}/linters
# test that we can build a valid package
commands =
python setup.py sdist bdist_wheel
python -m twine check dist/*
[testenv:insights]
commands =
pip check
pip install .[insights]
pip check
[testenv:pep8]
basepython = python3
commands = flake8 {posargs}
[testenv:venv]
basepython = python3
commands = {posargs}
[testenv:py27]
basepython = python2.7
commands = pytest {posargs}
[testenv:py35]
basepython = python3.5
commands = pytest {posargs}
[testenv:py36]
basepython = python3.6
commands = pytest {posargs}
[testenv:py37]
basepython = python3.7
commands = pytest {posargs}
[testenv:cover]
commands = python setup.py test --coverage --testr-args={posargs}
[testenv:docs]
basepython = python3
commands = python setup.py build_sphinx
[testenv:debug]
basepython = python3
commands = oslo_debug_helper {posargs}
[testenv:publish]
envdir = {toxworkdir}/py27
commands =
rm -rf dist/*
rm -rf build/*
python setup.py sdist bdist_wheel
twine upload dist/*
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125,E226,E302,E41,E231,E203,H233,H306,H238,H236,H404,H405,W504
max-line-length = 100
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ansible/*,.browbeat-venv,.perfkit-venv,.rally-venv,.shaker-venv