From 6a147a21f1ff8796ffebcdbb7a11d636e9604391 Mon Sep 17 00:00:00 2001 From: Boris Pavlovic Date: Sat, 11 Jun 2016 20:27:58 -0700 Subject: [PATCH] Use pytest instead of testr - pytest is used by everybody - pytest works on MacOS and Windows without any issues - pytest doesn't require bash scripts in and .testrconfig in repo - pytest has built-in colorizer - pytest shows out of box slowest test - pytest shows progress This patch does 3 things: 1) Remove testr config file & requirments 2) Add pytest requirments 3) Change tox.ini to use pytest instead of testr To add parameters to py.test you should add -- and than all args. For example, tox -e py27 -- -k "db" Change-Id: Ide3ddd58a2d1635651fc53404cb5cc7c1c4bab5e --- .gitignore | 2 ++ test-requirements.txt | 3 ++- tox.ini | 7 ++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 95cdb085..d311e9b9 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,8 @@ cover .testrepository *.sqlite .venv +.cache +pytest_results.html # Docs doc/source/_build/ diff --git a/test-requirements.txt b/test-requirements.txt index e7708fe5..4abcc03d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,12 +2,13 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. hacking<0.10,>=0.9.2 +pytest>=2.7 +pytest-html coverage>=3.6 # Apache-2.0 ddt>=1.0.1 # MIT mock>=2.0 # BSD python-dateutil>=2.4.2 # BSD -testrepository>=0.0.18 # Apache-2.0/BSD testtools>=1.4.0 # MIT oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index b7d88c3a..3c354ee7 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ install_command = pip install -U {opts} {packages} usedevelop = True commands = find . -type f -name "*.pyc" -delete - python setup.py testr --slowest --testr-args='{posargs}' + py.test --html=pytest_results.html --durations=10 "tests/unit" {posargs} distribute = false basepython = python2.7 passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY @@ -35,7 +35,6 @@ basepython = python3.4 [testenv:venv] commands = {posargs} - [testenv:debug] commands = oslo_debug_helper -t tests {posargs} @@ -45,7 +44,9 @@ commands = oslo_debug_helper -t tests {posargs} [testenv:cli] sitepackages = True -commands = {toxinidir}/tests/ci/rally-integrated.sh +commands = + find . -type f -name "*.pyc" -delete + py.test --html=pytest_results.html --durations=10 "tests/functional" {posargs} [testenv:cover]