b0c2f1c4e2
Recently JSONB replaced a back-end agnostic data type for the "data" column in the Document model. This made it necessary to drop support for running Deckhand unit tests with any other database store. However, this arragenement is undesirable as a user shouldn't need to have postgresql installed just to kick off unit tests. So, this PS re-adds support for running unit tests via an in-memory sqlite database. To run unit tests with sqlite: tox -e py35 Unit tests still run against postgresql via: tox -e py35-postgresql Both jobs are executed in CICD already. This PS also updates the remaining DB columns to use JSONB if postgresql is enabled; else fallback columns are used for testing with sqlite. This is a necessary change to make the column data types consistent. Change-Id: I951f2f04fd013d635bb7653a238ff1eb3725b5e1
93 lines
2.7 KiB
INI
93 lines
2.7 KiB
INI
[tox]
|
||
envlist = py{35,27}-{postgresql,},pep8,bandit,docs
|
||
|
||
[testenv]
|
||
usedevelop = True
|
||
whitelist_externals = bash
|
||
find
|
||
rm
|
||
flake8
|
||
setenv = VIRTUAL_ENV={envdir}
|
||
OS_TEST_PATH=./deckhand/tests/unit
|
||
LANGUAGE=en_US
|
||
LC_ALL=en_US.utf-8
|
||
passenv = OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_TEST_TIMEOUT OS_TEST_LOCK_PATH OS_TEST_PATH http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY DECKHAND_IMAGE
|
||
deps = -r{toxinidir}/requirements.txt
|
||
-r{toxinidir}/test-requirements.txt
|
||
commands =
|
||
find . -type f -name "*.pyc" -delete
|
||
rm -Rf .testrepository/times.dbm
|
||
|
||
[testenv:py27]
|
||
commands =
|
||
{[testenv]commands}
|
||
ostestr '{posargs}'
|
||
|
||
[testenv:py27-postgresql]
|
||
commands =
|
||
{[testenv]commands}
|
||
{toxinidir}/tools/run_pifpaf.sh '{posargs}'
|
||
|
||
[testenv:py35]
|
||
commands =
|
||
{[testenv]commands}
|
||
ostestr '{posargs}'
|
||
|
||
[testenv:py35-postgresql]
|
||
commands =
|
||
{[testenv]commands}
|
||
{toxinidir}/tools/run_pifpaf.sh '{posargs}'
|
||
|
||
[testenv:functional]
|
||
usedevelop = True
|
||
setenv = VIRTUAL_ENV={envdir}
|
||
OS_TEST_PATH=./deckhand/tests/functional
|
||
LANGUAGE=en_US
|
||
deps = -r{toxinidir}/requirements.txt
|
||
-r{toxinidir}/test-requirements.txt
|
||
commands =
|
||
find . -type f -name "*.pyc" -delete
|
||
{toxinidir}/tools/functional-tests.sh '{posargs}'
|
||
|
||
[testenv:cover]
|
||
commands =
|
||
coverage erase
|
||
find . -type f -name "*.pyc" -delete
|
||
python setup.py testr --coverage --testr-args='{posargs}'
|
||
coverage report
|
||
|
||
[testenv:bandit]
|
||
whitelist_externals = bandit
|
||
commands =
|
||
bandit -r deckhand -x deckhand/tests -n 5
|
||
|
||
[testenv:releasenotes]
|
||
deps = -r{toxinidir}/doc/requirements.txt
|
||
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||
|
||
[testenv:genconfig]
|
||
commands = oslo-config-generator --config-file=etc/deckhand/config-generator.conf
|
||
|
||
[testenv:genpolicy]
|
||
commands = oslopolicy-sample-generator --config-file=etc/deckhand/policy-generator.conf
|
||
|
||
[testenv:pep8]
|
||
commands = flake8 {posargs}
|
||
|
||
[flake8]
|
||
# [H106] Don’t put vim configuration in source files.
|
||
# [H203] Use assertIs(Not)None to check for None.
|
||
# [H204] Use assert(Not)Equal to check for equality.
|
||
# [H205] Use assert(Greater|Less)(Equal) for comparison.
|
||
# [H210] Require ‘autospec’, ‘spec’, or ‘spec_set’ in mock.patch/mock.patch.object calls
|
||
# [H904] Delay string interpolations at logging calls.
|
||
enable-extensions = H106,H203,H204,H205,H210,H904
|
||
ignore = E127,E128,E129,E131,H405
|
||
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,releasenotes,doc
|
||
|
||
[testenv:docs]
|
||
deps = -r{toxinidir}/doc/requirements.txt
|
||
commands =
|
||
rm -rf doc/build
|
||
python setup.py build_sphinx {posargs}
|