From f6069e9e42bf0ab4d63908c4e81dd59799f167a5 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 30 May 2018 14:20:14 +0100 Subject: [PATCH] Migrate to stestr This should both keep mtreinish happy and get rid of annoying 'db type could not be determined' messages in one fell swoop. Change-Id: I0db004a8c8d75359e7d08c73b82f98c62a7e5f7d Signed-off-by: Stephen Finucane --- .gitignore | 3 +-- .stestr.conf | 3 +++ .testr.conf | 7 ------- lower-constraints.txt | 1 + test-requirements.txt | 2 +- tox.ini | 14 ++++++++++---- 6 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index f6d68489..131bdf67 100644 --- a/.gitignore +++ b/.gitignore @@ -25,8 +25,7 @@ pip-log.txt .coverage* cover .tox -nosetests.xml -.testrepository +.stestr # Translations *.mo diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 00000000..1fbbb879 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./oslo_log/tests/unit +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 0edde418..00000000 --- a/.testr.conf +++ /dev/null @@ -1,7 +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:-60} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ./oslo_log $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/lower-constraints.txt b/lower-constraints.txt index c272ada5..c6cbe344 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -59,6 +59,7 @@ smmap2==2.0.3 snowballstemmer==1.2.1 Sphinx==1.6.5 sphinxcontrib-websupport==1.0.1 +stestr==2.0.0 stevedore==1.28.0 systemd-python==234 testrepository==0.0.20 diff --git a/test-requirements.txt b/test-requirements.txt index cc44b3b7..3aead8d5 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,7 @@ hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 -testrepository>=0.0.20 # Apache-2.0/BSD +stestr>=2.0.0 # Apache-2.0 testtools>=2.3.0 # MIT mock>=2.0.0 # BSD oslotest>=3.3.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 39f0726f..c8f2e371 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,8 @@ minversion = 2.0 envlist = py35,py27,pep8 [testenv] +whitelist_externals = + find setenv = VIRTUAL_ENV={envdir} BRANCH_NAME=master @@ -11,8 +13,9 @@ install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:h deps = -r{toxinidir}/test-requirements.txt -e.[fixtures] commands = - python setup.py test --coverage --coverage-package-name=oslo_log --slowest --testr-args='{posargs}' - coverage report --show-missing + find . -type f -name "*.pyc" -delete + stestr run {posargs} + stestr slowest [testenv:pep8] basepython = python3 @@ -36,7 +39,11 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen [testenv:cover] basepython = python3 commands = - python setup.py test --coverage --coverage-package-name=oslo_log --testr-args='{posargs}' + coverage erase + {[testenv]commands} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml coverage report --show-missing [testenv:bandit] @@ -52,7 +59,6 @@ deps = [flake8] # E123, E125 skipped as they are invalid PEP-8. - show-source = True ignore = E123,E125,H405 exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,__init__.py