Browse Source

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
changes/32/693032/1
Pete Vander Giessen 11 months ago
parent
commit
0824a570ec
3 changed files with 23 additions and 56 deletions
  1. +1
    -2
      tools/init/tests/test_question.py
  2. +5
    -14
      tools/update_path.py
  3. +17
    -40
      tox.ini

+ 1
- 2
tools/init/tests/test_question.py 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)


##############################################################################


+ 5
- 14
tools/update_path.py 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()

+ 17
- 40
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
[testenv:xenial]
# Run basic tests, under xenial.
setenv =
MULTIPASS=true
DISTRO=eoan

commands =
{toxinidir}/tools/basic_setup.sh
flake8 {toxinidir}/tests/
{toxinidir}/tests/test_basic.py
DISTRO=xenial

[testenv:disco]
# Just run basic_test.sh, with multipass support, on disco.
deps = -r{toxinidir}/test-requirements.txt
# Run basic tests, under disco.
setenv =
MULTIPASS=true
DISTRO=disco

[testenv:xenial]
# Just run basic_test.sh, with multipass support, on xenial.
deps = -r{toxinidir}/test-requirements.txt
[testenv:eoan]
# Run basic tests, under eoan.
setenv =
MULTIPASS=true
DISTRO=xenial

commands =
{toxinidir}/tools/basic_setup.sh
flake8 {toxinidir}/tests/
{toxinidir}/tests/test_basic.py
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/


Loading…
Cancel
Save