test: add support for running tox tests

Setup tox to run both flake8 and nosetests

Signed-off-by: Dan Streetman <ddstreet@canonical.com>
This commit is contained in:
Dan Streetman 2020-06-15 17:47:25 -04:00
parent e7f0447342
commit 3eefdec9b6
4 changed files with 38 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
.coverage
.tox
/ubuntu_dev_tools.egg-info/
__pycache__/
*.pyc

9
requirements.txt Normal file
View File

@ -0,0 +1,9 @@
python-debian
python-debianbts
distro-info
httplib2
launchpadlib
requests
setuptools
termcolor
pyyaml

4
test-requirements.txt Normal file
View File

@ -0,0 +1,4 @@
coverage
flake8 >= 3.8.0
nose
mock

23
tox.ini Normal file
View File

@ -0,0 +1,23 @@
[tox]
envlist = flake8,nose
skipsdist = True
[testenv]
base_python = python3
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
usedevelop = True
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
install_command = pip install {opts} {packages}
[testenv:flake8]
commands = flake8 {posargs}
[testenv:nose]
commands = nosetests -v --with-coverage --cover-package=ubuntutools {posargs:ubuntutools}
[flake8]
verbose = 2
max-line-length = 99
extend-exclude = ubuntu-archive-assistant,ubuntu_archive_assistant