Clean up tox.ini a bit

Remove some of the redundancy in tox.ini.

Fixed some lint issues that weren't caught before due to gaps in the
linting coverage.

I think that there's more work to be done here, but this does make
things better than they were before.

Change-Id: I82487dbb9366f3de16b25615bd081b6315671655
This commit is contained in:
Pete Vander Giessen 2019-11-05 15:36:24 +00:00
parent a89cb36883
commit 0824a570ec
3 changed files with 28 additions and 61 deletions

View File

@ -7,8 +7,7 @@ import mock
# TODO: drop in test runner and get rid of this line. # TODO: drop in test runner and get rid of this line.
sys.path.append(os.getcwd()) # noqa sys.path.append(os.getcwd()) # noqa
from init.questions.question import (Question, InvalidQuestion, InvalidAnswer, from init.questions.question import (Question, InvalidQuestion, InvalidAnswer)
AnswerNotImplemented)
############################################################################## ##############################################################################

View File

@ -17,30 +17,20 @@ import os
import shutil import shutil
import sys import sys
LD_LIBRARY_PATH = ( LD_LIBRARY_PATH = (
'$SNAP/lib', '$SNAP/lib',
'$SNAP/lib/$SNAPCRAFT_ARCH_TRIPLET', '$SNAP/lib/$SNAPCRAFT_ARCH_TRIPLET',
'$SNAP/usr/lib', '$SNAP/usr/lib',
'$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET', '$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET',
'$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio', '$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio',)
# '/snap/core18/current/lib',
# '/snap/core18/current/lib/$SNAPCRAFT_ARCH_TRIPLET',
# '/snap/core18/current/lib/systemd',
# '/snap/core18/current/usr/lib',
# '/snap/core18/current/var/lib',
# '/snap/core18/current/usr/lib/$SNAPCRAFT_ARCH_TRIPLET',
)
PATH = ( PATH = (
'$SNAP/usr/sbin', '$SNAP/usr/sbin',
'$SNAP/usr/bin', '$SNAP/usr/bin',
'$SNAP/sbin', '$SNAP/sbin',
'$SNAP/bin', '$SNAP/bin',
# '/snap/core18/current/bin', '$PATH')
# '/snap/core18/current/usr/sbin',
# '/snap/core18/current/usr/bin',
# '/snap/core18/current/sbin',
'$PATH'
)
def main(): def main():
"""Replace PATH and LD_LIBRARY_PATH with lists above. """Replace PATH and LD_LIBRARY_PATH with lists above.
@ -81,5 +71,6 @@ def main():
print('File updated! Please manually inspect the changes ' print('File updated! Please manually inspect the changes '
'and commit them via git.') 'and commit them via git.')
if __name__ == '__main__': if __name__ == '__main__':
main() main()

67
tox.ini
View File

@ -5,19 +5,22 @@ skipsdist = True
[testenv] [testenv]
basepython=python3 basepython=python3
install_command = pip install {opts} {packages} install_command = pip install {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt
setenv = setenv =
PATH = /snap/bin:{env:PATH} PATH = /snap/bin:{env:PATH}
passenv = HOME TERM passenv = HOME TERM DISTRO
whitelist_externals = whitelist_externals =
sudo sudo
/snap/bin/snapcraft /snap/bin/snapcraft
commands =
{toxinidir}/tools/basic_setup.sh
flake8 {toxinidir}/tests/
{toxinidir}/tests/test_basic.py
[testenv:snap] [testenv:snap]
# Testing environment for the gerrit gate. Named 'snap' to conform to # Testing environment for the gerrit gate. Named 'snap' to conform to
# the requirements of the snap friendly job that we inherit from in # the requirements of the snap friendly job that we inherit from in
# .zuul.yaml. # .zuul.yaml.
basepython=python3
deps = -r{toxinidir}/test-requirements.txt
commands = commands =
{toxinidir}/tools/lxd_build.sh {toxinidir}/tools/lxd_build.sh
flake8 {toxinidir}/tests/ flake8 {toxinidir}/tests/
@ -33,62 +36,40 @@ commands =
# use the "snap" environment above. Beware that you will wind up with # use the "snap" environment above. Beware that you will wind up with
# a lot of things installed, including potentially the locally built # a lot of things installed, including potentially the locally built
# version of MicroStack! # version of MicroStack!
deps = -r{toxinidir}/test-requirements.txt
setenv = setenv =
PATH = /snap/bin:{env:PATH}
MULTIPASS=true MULTIPASS=true
commands = commands =
{toxinidir}/tools/multipass_build.sh {toxinidir}/tools/multipass_build.sh
flake8 {toxinidir}/tests/ flake8 {toxinidir}/tests/
{toxinidir}/tests/test_basic.py {toxinidir}/tests/test_basic.py
[testenv:basic] [testenv:basic]
# Just run basic_test.sh, with multipass support. # Run basic tests, with default distro.
deps = -r{toxinidir}/test-requirements.txt
setenv = setenv =
MULTIPASS=true MULTIPASS=true
commands =
{toxinidir}/tools/basic_setup.sh
flake8 {toxinidir}/tests/
{toxinidir}/tests/test_basic.py
[testenv:eoan]
# Just run basic_test.sh, with multipass support, on eoan.
# TODO: refactor so that there isn't so much copypasta here and below.
deps = -r{toxinidir}/test-requirements.txt
setenv =
MULTIPASS=true
DISTRO=eoan
commands =
{toxinidir}/tools/basic_setup.sh
flake8 {toxinidir}/tests/
{toxinidir}/tests/test_basic.py
[testenv:disco]
# Just run basic_test.sh, with multipass support, on disco.
deps = -r{toxinidir}/test-requirements.txt
setenv =
MULTIPASS=true
DISTRO=disco
[testenv:xenial] [testenv:xenial]
# Just run basic_test.sh, with multipass support, on xenial. # Run basic tests, under xenial.
deps = -r{toxinidir}/test-requirements.txt
setenv = setenv =
MULTIPASS=true MULTIPASS=true
DISTRO=xenial DISTRO=xenial
commands = [testenv:disco]
{toxinidir}/tools/basic_setup.sh # Run basic tests, under disco.
flake8 {toxinidir}/tests/ setenv =
{toxinidir}/tests/test_basic.py MULTIPASS=true
DISTRO=disco
[testenv:eoan]
# Run basic tests, under eoan.
setenv =
MULTIPASS=true
DISTRO=eoan
[testenv:cluster] [testenv:cluster]
# Test out clustering! # Test out clustering!
# Requires multipass. # Requires multipass.
deps = -r{toxinidir}/test-requirements.txt
setenv = setenv =
MULTIPASS=true MULTIPASS=true
@ -98,21 +79,17 @@ commands =
{toxinidir}/tests/test_cluster.py {toxinidir}/tests/test_cluster.py
[testenv:build] [testenv:build]
# Just run basic_test.sh, with multipass support. # Just build the snap, using multipass.
deps = -r{toxinidir}/test-requirements.txt
setenv = setenv =
MULTIPASS=true MULTIPASS=true
commands = commands =
flake8 {toxinidir}/tests/
flake8 {toxinidir}/tools/init/init
flake8 {toxinidir}/tools/cluster/cluster
{toxinidir}/tools/multipass_build.sh {toxinidir}/tools/multipass_build.sh
[testenv:lint] [testenv:lint]
deps = -r{toxinidir}/test-requirements.txt
commands = commands =
flake8 {toxinidir}/tests/ flake8 {toxinidir}/tests/
flake8 {toxinidir}/tools/
flake8 {toxinidir}/tools/init/init/ flake8 {toxinidir}/tools/init/init/
flake8 {toxinidir}/tools/launch/launch/ flake8 {toxinidir}/tools/launch/launch/
flake8 {toxinidir}/tools/cluster/cluster/ flake8 {toxinidir}/tools/cluster/cluster/