Switch to stestr

According to Openstack summit session [1],
stestr is maintained project to which all Openstack projects should migrate.
Let's switch to stestr as other projects have already moved to it.

[1] https://etherpad.openstack.org/p/YVR-python-pti

Change-Id: Ib58745d5c0d98fb79eb3cf7278c2cbfb5160efcd
This commit is contained in:
Vu Cong Tuan 2018-07-10 13:34:43 +07:00 committed by Bernard Cafarelli
parent 301aa7e161
commit 259c386d42
No known key found for this signature in database
GPG Key ID: D148244A3C2462BD
7 changed files with 20 additions and 16 deletions

2
.gitignore vendored
View File

@ -17,6 +17,6 @@ run_tests.err.log
run_tests.log
.autogenerated
.coverage
.testrepository/
.stestr/
.tox/
.venv/

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./neutronclient/tests/unit
top_dir=./

View File

@ -1,4 +0,0 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutronclient/tests/unit} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -105,11 +105,10 @@ snowballstemmer==1.2.1
Sphinx==1.6.2
sphinxcontrib-websupport==1.0.1
statsd==3.2.1
stestr==1.0.0
stestr==2.0.0
stevedore==1.20.0
tempest==17.1.0
tenacity==3.2.1
testrepository==0.0.18
testscenarios==0.4
testtools==2.2.0
traceback2==1.4.0

View File

@ -32,11 +32,11 @@ function generate_test_logs {
function generate_testr_results {
# Give job user rights to access tox logs
sudo -H -u $USER chmod o+rw .
sudo -H -u $USER chmod o+rw -R .testrepository
if [ -f ".testrepository/0" ] ; then
.tox/$VENV/bin/subunit-1to2 < .testrepository/0 > ./testrepository.subunit
$SCRIPTS_DIR/subunit2html ./testrepository.subunit testr_results.html
gzip -9 ./testrepository.subunit
sudo -H -u $USER chmod o+rw -R .stestr
if [ -f ".stestr/0" ] ; then
.tox/$VENV/bin/subunit-1to2 < .stestr/0 > ./stestr.subunit
$SCRIPTS_DIR/subunit2html ./stestr.subunit testr_results.html
gzip -9 ./stestr.subunit
gzip -9 ./testr_results.html
sudo mv ./*.gz /opt/stack/logs/
fi

View File

@ -13,7 +13,7 @@ osprofiler>=2.3.0 # Apache-2.0
python-openstackclient>=3.12.0 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD
requests-mock>=1.2.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
stestr>=2.0.0 # Apache-2.0
testtools>=2.2.0 # MIT
testscenarios>=0.4 # Apache-2.0/BSD
tempest>=17.1.0 # Apache-2.0

12
tox.ini
View File

@ -21,7 +21,7 @@ deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/re
commands = sh -c "find . -type d -name '.?*' -prune -o \
\( -type d -name '__pycache__' -o -type f -name '*.py[co]' \) \
-print0 | xargs -0 rm -rf"
python setup.py testr --testr-args='{posargs}'
stestr run {posargs}
whitelist_externals = sh
[testenv:pep8]
@ -47,9 +47,15 @@ setenv =
[testenv:cover]
basepython = python3
setenv =
{[testenv]setenv}
PYTHON=coverage run --source neutronclient --parallel-mode
commands =
python setup.py test --coverage --coverage-package-name=neutronclient --testr-args='{posargs}'
coverage report
stestr run '{posargs}'
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:docs]
basepython = python3