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.
sys.path.append(os.getcwd()) # noqa
from init.questions.question import (Question, InvalidQuestion, InvalidAnswer,
AnswerNotImplemented)
from init.questions.question import (Question, InvalidQuestion, InvalidAnswer)
##############################################################################

View File

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

67
tox.ini
View File

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