Merge "Refactored tox.ini to ease usage for developer and CI"

This commit is contained in:
Zuul 2019-04-11 23:53:17 +00:00 committed by Gerrit Code Review
commit be598e502e
4 changed files with 19 additions and 36 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ scripts/website/tripleosphinx/
scripts/website/planet-2.0/
scripts/website/planet.html.tmplc
.eggs/
.tox/
.coverage
.pytest_cache/

View File

@ -4,5 +4,5 @@ pytest-cov
mock
requests
pprint
pre-commit>=1.10 # MIT License
pre-commit>=1.10 # MIT License
PyYAML

42
tox.ini
View File

@ -1,5 +1,6 @@
[tox]
envlist = linters, py27, py35, py36, py37
minversion = 3.4.0
ignore_basepython_conflict = True
skip_missing_interpreters = True
@ -8,27 +9,27 @@ usedevelop = True
setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
whitelist_externals =
bash
commands_pre =
pip install -q bindep
bindep test
commands = pytest {posargs:--cov=emit_releases_file} scripts/emit_releases_file
[testenv:venv]
basepython = python3
commands = {posargs}
[testenv:pyflakes]
basepython = python3
deps = pyflakes
commands = pyflakes setup.py scripts
[testenv:linters]
basepython = python3
whitelist_externals = bash
commands = python -m pre_commit run --source HEAD^ --origin HEAD
commands =
python -m pre_commit run -a
# deprecated: use linters instead. kept only as a convenience alias
[testenv:pep8]
basepython = python3
envdir = {toxworkdir}/linters
whitelist_externals = {[testenv:linters]whitelist_externals}
whitelist_externals = {[testenv]whitelist_externals}
commands = {[testenv:linters]commands}
[testenv:cireport]
@ -36,26 +37,3 @@ basepython = python3
passenv =
SSH_AUTH_SOCK
commands = python scripts/tripleo-jobs-gerrit.py {posargs}
# This environment can be used to quickly validate that all needed system
# packages required to successfully execute test targets are installed
[testenv:bindep]
basepython = python3
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files.
deps = bindep
commands = bindep test
# This environment is used to run unit tests
[testenv:py27]
deps = {[testenv]deps}
changedir = scripts/emit_releases_file
commands = pytest {posargs:--cov=emit_releases_file}
[testenv:py35]
basepython = python3.5
deps={[testenv]deps}
changedir = {[testenv:py27]changedir}
commands = {[testenv:py27]commands}

View File

@ -16,12 +16,16 @@
check:
jobs:
- openstack-tox-linters
- openstack-tox-py27:
- openstack-tox-py27: &files
files:
- ^bindep.txt$
- ^requirements.txt$
- ^scripts/emit_releases_file/.*$
- ^setup.cfg$
- ^setup.py$
- ^tox.ini$
- openstack-tox-py35:
files:
- ^scripts/emit_releases_file/.*$
<<: *files
- tripleo-buildimage-overcloud-full-centos-7:
files:
- ^playbooks/tripleo-buildimage/.*$