From 77341ef4b7148452813a693cfef6bb73e66e27a2 Mon Sep 17 00:00:00 2001 From: Nicholas Jones Date: Wed, 9 Aug 2017 12:40:56 -0500 Subject: [PATCH] Set up tox to run unit tests Makes changes to tox configuration so unit tests can be run in the py27 environment. Change-Id: I4867dfbdf180e6f84ca178b0770a3a3ae0ce32bf --- .testr.conf | 7 +++++++ orm/tests/{ => unit}/test_units.py | 0 test-requirements.txt | 1 + tox.ini | 11 ++++++++++- 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .testr.conf rename orm/tests/{ => unit}/test_units.py (100%) diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 00000000..c8b1712c --- /dev/null +++ b/.testr.conf @@ -0,0 +1,7 @@ +[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 ./ ${OS_TEST_PATH:-./orm/tests/unit} $LISTOPT $IDOPTION +test_id_option=--load-list $IDFILE +test_list_option=--list diff --git a/orm/tests/test_units.py b/orm/tests/unit/test_units.py similarity index 100% rename from orm/tests/test_units.py rename to orm/tests/unit/test_units.py diff --git a/test-requirements.txt b/test-requirements.txt index bedac3d2..241c53c0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,6 +11,7 @@ oslotest>=1.10.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD testtools>=1.4.0 # MIT openstackdocstheme>=1.11.0 # Apache-2.0 +os-testr>=0.8.0 # Apache-2.0 # releasenotes reno>=1.8.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 962ab749..d062feb3 100644 --- a/tox.ini +++ b/tox.ini @@ -9,8 +9,17 @@ install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstac setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning + deps = -r{toxinidir}/test-requirements.txt +commands = + find . -type f -name "*.pyc" -delete + ostestr {posargs} + +whitelist_externals = + bash + find + [testenv:pep8] commands = flake8 {posargs} @@ -18,7 +27,7 @@ commands = flake8 {posargs} commands = {posargs} [testenv:cover] -commands = python setup.py test --coverage --testr-args='{posargs}' +commands = python setup.py testr --coverage --testr-args='{posargs}' [testenv:docs] commands = python setup.py build_sphinx