Migrate to stestr for running tests
stestr is recommended by OpenStack Project Testing Interface for running tests [1]. This change migrates to stestr for running unit tests and coverage job. Modified `cover` env allows running it as Zuul job and visualising its results in Gerrit. [1] https://governance.openstack.org/tc/reference/pti/python.html#python-test-running Change-Id: I9e8b79d7a18cd36946daff10abb1a2f43b1aa3a1
This commit is contained in:
parent
a74978619e
commit
9586972ddd
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,7 +2,7 @@
|
|||||||
*.mo
|
*.mo
|
||||||
*.pyc
|
*.pyc
|
||||||
.coverage
|
.coverage
|
||||||
.testrepository
|
.stestr
|
||||||
.tox
|
.tox
|
||||||
AUTHORS
|
AUTHORS
|
||||||
build/*
|
build/*
|
||||||
|
3
.stestr.conf
Normal file
3
.stestr.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
test_path=${OS_TEST_PATH:-ceilometer/tests/unit}
|
||||||
|
top_dir=./
|
@ -1,9 +0,0 @@
|
|||||||
[DEFAULT]
|
|
||||||
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
|
||||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
|
||||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-600} \
|
|
||||||
${PYTHON:-python} -m subunit.run discover ${OS_TEST_PATH:-./ceilometer/tests} -t . $LISTOPT $IDOPTION
|
|
||||||
test_id_option=--load-list $IDFILE
|
|
||||||
test_list_option=--list
|
|
||||||
# NOTE(chdent): Only used/matches on gabbi-related tests.
|
|
||||||
group_regex=(gabbi\.(suitemaker|driver)\.test_gabbi_(?:prefix_|)[^_]+)_
|
|
@ -27,6 +27,7 @@
|
|||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
- telemetry-tox-py37
|
- telemetry-tox-py37
|
||||||
|
- openstack-tox-cover
|
||||||
- grenade-dsvm-ceilometer:
|
- grenade-dsvm-ceilometer:
|
||||||
irrelevant-files:
|
irrelevant-files:
|
||||||
- ^(test-|)requirements.txt$
|
- ^(test-|)requirements.txt$
|
||||||
|
@ -13,10 +13,9 @@ oslotest>=2.15.0 # Apache-2.0
|
|||||||
oslo.vmware>=1.16.0 # Apache-2.0
|
oslo.vmware>=1.16.0 # Apache-2.0
|
||||||
pyOpenSSL>=0.14 # Apache-2.0
|
pyOpenSSL>=0.14 # Apache-2.0
|
||||||
sphinx>=1.6.2 # BSD
|
sphinx>=1.6.2 # BSD
|
||||||
testrepository>=0.0.18 # Apache-2.0/BSD
|
|
||||||
testscenarios>=0.4 # Apache-2.0/BSD
|
testscenarios>=0.4 # Apache-2.0/BSD
|
||||||
testtools>=1.4.0 # MIT
|
testtools>=1.4.0 # MIT
|
||||||
gabbi>=1.30.0 # Apache-2.0
|
gabbi>=1.30.0 # Apache-2.0
|
||||||
requests-aws>=0.1.4 # BSD License (3 clause)
|
requests-aws>=0.1.4 # BSD License (3 clause)
|
||||||
os-testr>=0.4.1 # Apache-2.0
|
|
||||||
kafka-python>=1.3.2 # Apache-2.0
|
kafka-python>=1.3.2 # Apache-2.0
|
||||||
|
stestr>=1.0.0 # Apache-2.0
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
TESTRARGS=$1
|
|
||||||
|
|
||||||
# --until-failure is not compatible with --subunit see:
|
|
||||||
#
|
|
||||||
# https://bugs.launchpad.net/testrepository/+bug/1411804
|
|
||||||
#
|
|
||||||
# this work around exists until that is addressed
|
|
||||||
if [[ "$TESTARGS" =~ "until-failure" ]]; then
|
|
||||||
python setup.py testr --slowest --testr-args="$TESTRARGS"
|
|
||||||
else
|
|
||||||
python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | subunit-trace -f
|
|
||||||
fi
|
|
11
tox.ini
11
tox.ini
@ -10,19 +10,22 @@ deps = .[gnocchi,zaqar]
|
|||||||
install_command = pip install -U {opts} {packages}
|
install_command = pip install -U {opts} {packages}
|
||||||
usedevelop = True
|
usedevelop = True
|
||||||
setenv = VIRTUAL_ENV={envdir}
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
OS_TEST_PATH=ceilometer/tests/unit
|
|
||||||
CEILOMETER_TEST_BACKEND={env:CEILOMETER_TEST_BACKEND:none}
|
CEILOMETER_TEST_BACKEND={env:CEILOMETER_TEST_BACKEND:none}
|
||||||
passenv = OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE CEILOMETER_*
|
passenv = OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE CEILOMETER_*
|
||||||
commands =
|
commands =
|
||||||
{toxinidir}/tools/pretty_tox.sh "{posargs}"
|
stestr run {posargs}
|
||||||
oslo-config-generator --config-file=etc/ceilometer/ceilometer-config-generator.conf
|
oslo-config-generator --config-file=etc/ceilometer/ceilometer-config-generator.conf
|
||||||
whitelist_externals = bash
|
whitelist_externals = bash
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
setenv = OS_TEST_PATH=ceilometer/tests
|
setenv =
|
||||||
|
PYTHON=coverage run --source ceilometer --parallel-mode
|
||||||
commands =
|
commands =
|
||||||
python setup.py testr --slowest --coverage --testr-args="{posargs}"
|
stestr run '{posargs}'
|
||||||
|
coverage combine
|
||||||
|
coverage html -d cover
|
||||||
|
coverage xml -o cover/coverage.xml
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
|
Loading…
Reference in New Issue
Block a user