Avoid pollution and false positives with tox.ini

- updated the build testenv to build in a tmp directory outside src
- removing sitepackages in tox.ini to avoid test env pollution
- skip_missing_interpreters in tox.ini set to False to avoid false
positives by skipping missing interpreters.

Change-Id: I742a9d013a6ae40eccd6e2d83c20117f1e1a380f
This commit is contained in:
Camille Rodriguez 2019-08-27 09:55:44 -04:00
parent 5e8e8b2214
commit 1d86353754
2 changed files with 33 additions and 8 deletions

View File

@ -9,6 +9,7 @@ tags:
- storage
- file-servers
- misc
series: []
peers:
mon:
interface: ceph

40
tox.ini
View File

@ -1,29 +1,41 @@
[tox]
skipsdist = True
envlist = pep8
toxworkdir = /tmp/tox
# NOTE(beisner): Avoid build/test env pollution by not enabling sitepackages.
sitepackages = False
# NOTE(beisner): Avoid false positives by not skipping missing interpreters.
skip_missing_interpreters = False
[testenv]
basepython = python2.7
basepython = python3
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
TERM=linux
JUJU_REPOSITORY={toxinidir}/build
JUJU_REPOSITORY={envdir}/tmp/build
passenv = http_proxy https_proxy
install_command =
pip install {opts} {packages}
deps =
-r{toxinidir}/requirements.txt
whitelist_externals = /bin/true /bin/echo
[testenv:build]
commands =
/bin/echo 'WARNING: *build* target is for testing only.'
charm-build --log-level DEBUG -o {toxinidir}/build .
whitelist_externals = /bin/true /bin/echo /bin/mkdir /bin/ln
[testenv:venv]
basepython = python3
commands = {posargs}
[testenv:build]
# ``charm build`` refuses to output to a subdirectory to the source tree
# The gate check will look for and validate the built artifacts in the source
# tree.
# Build the artifats under /tmp and link back to source directory to alleviate.
commands =
/bin/echo 'WARNING: *build* target is for testing only.'
/bin/mkdir -p {envdir}/tmp
charm-build --log-level DEBUG -o {envdir}/tmp/build .
/bin/ln -s {envdir}/tmp/build/builds {envdir}/tmp/build/trusty
/bin/ln -s {envdir}/tmp/build {toxinidir}/build
[testenv:py27]
basepython = python2.7
deps = -r{toxinidir}/test-requirements.txt
@ -42,6 +54,18 @@ deps = -r{toxinidir}/test-requirements.txt
# TODO: Need to write unit tests then remove the following command.
commands = /bin/true
[testenv:py36]
basepython = python3.6
deps = -r{toxinidir}/test-requirements.txt
# TODO: Need to write unit tests then remove the following command.
commands = /bin/true
[testenv:py37]
basepython = python3.7
deps = -r{toxinidir}/test-requirements.txt
# TODO: Need to write unit tests then remove the following command.
commands = /bin/true
[testenv:pep8]
basepython = python3
commands = /bin/true