Run tests via tox

This could simplify jenkins job configuration and make the tasks
trackable in git.

JIRA: RHELCMP-1618
Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2020-07-24 11:33:57 +08:00
parent 05a5e2b1f0
commit 495a4c48b2

74
tox.ini
View File

@ -1,21 +1,81 @@
[tox] [tox]
envlist = py27, py36 envlist = flake8, black, py27, py3
[testenv] [testenv:flake8]
deps = deps =
flake8 flake8
whitelist_externals = sh whitelist_externals = sh
commands = commands =
sh -c "flake8 pungi pungi_utils setup.py tests/*py" sh -c "flake8 pungi pungi_utils setup.py tests/*py"
[testenv:py36] [testenv:black]
basepython = python3
whitelist_externals = sh
deps = deps =
{[testenv]deps} {[testenv:flake8]deps}
black black
commands = commands =
{[testenv]commands} {[testenv:flake8]commands}
black --check --diff pungi pungi_utils setup.py tests --exclude tests/_composes black --check --diff pungi pungi_utils setup.py tests --exclude tests/_composes
[testenv:py27]
sitepackages = true
deps =
funcsigs
productmd
jsonschema
fedmsg
ordered_set
python-multilib
modulemd
kobo
koji
pykickstart
lxml
dogpile.cache
mmdzanata
parameterized
dict.sorted
mock
nose
nose-cov
whitelist_externals =
sh
make
coverage
commands =
sh -c 'find . -name "*.pyc" -exec rm -f \{\} +'
make test-coverage
coverage xml
[testenv:py3]
sitepackages = true
deps =
funcsigs
productmd
jsonschema
fedmsg
ordered_set
python-multilib
unittest2
modulemd
kobo
koji
pykickstart
lxml
dogpile.cache
mmdzanata
parameterized
dict.sorted
mock
nose
whitelist_externals =
sh
make
commands =
sh -c 'find . -name "__pycache__" -exec rm -rf \{\} +'
make test
[flake8] [flake8]
exclude = doc/*,*.pyc,*.py~,*.in,*.spec,*.sh,*.rst exclude = doc/*,*.pyc,*.py~,*.in,*.spec,*.sh,*.rst
filename = *.py filename = *.py
@ -30,4 +90,6 @@ max-line-length = 88
ignore = E402,H301,H306,E226,W503,E203 ignore = E402,H301,H306,E226,W503,E203
[run] [run]
omit = tests/* omit =
tests/*
.tox/*