From 77d2c303ec146f338d5be7c52864774aa49529f9 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 10 Jan 2018 11:45:52 +0000 Subject: [PATCH] Re-organize how the tests are structured This now matches the standard layout generated by the cookiecutter project [1]. [1] https://github.com/openstack/tempest-plugin-cookiecutter/ Change-Id: I0fd623c02e974262ac02027dfe950c5a0a56ee77 --- .stestr.conf | 3 +++ tox.ini | 20 ++++++++++++------- whitebox_tempest_plugin/README.rst | 10 ++++++++++ .../{lib => tests/scenario}/__init__.py | 0 .../{ => tests/scenario}/base.py | 0 .../scenario/test_pointer_device_type.py | 2 +- .../scenario/test_refresh_quota_usages.py | 2 +- .../{scenario => tests/unit}/__init__.py | 0 .../tests/{ => unit}/base.py | 0 .../tests/{ => unit}/test_placeholder.py | 2 +- 10 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 .stestr.conf create mode 100644 whitebox_tempest_plugin/README.rst rename whitebox_tempest_plugin/{lib => tests/scenario}/__init__.py (100%) rename whitebox_tempest_plugin/{ => tests/scenario}/base.py (100%) rename whitebox_tempest_plugin/{ => tests}/scenario/test_pointer_device_type.py (98%) rename whitebox_tempest_plugin/{ => tests}/scenario/test_refresh_quota_usages.py (98%) rename whitebox_tempest_plugin/{scenario => tests/unit}/__init__.py (100%) rename whitebox_tempest_plugin/tests/{ => unit}/base.py (100%) rename whitebox_tempest_plugin/tests/{ => unit}/test_placeholder.py (94%) diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 00000000..30b8d1b4 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./whitebox_tempest_plugin/tests/unit +top_dir=./ diff --git a/tox.ini b/tox.ini index 56a81e8f..d78ae4db 100644 --- a/tox.ini +++ b/tox.ini @@ -1,25 +1,31 @@ [tox] -envlist = flake8,py27 minversion = 2.3.1 +envlist = flake8,py27,py35 skipsdist = True [testenv] setenv = - VIRTUAL_ENV={envdir} + VIRTUAL_ENV = {envdir} usedevelop = True install_command = pip install -U {opts} {packages} whitelist_externals = * deps = - -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt commands = - find . -type f -name "*.pyc" -delete - stestr --test-path ./whitebox_tempest_plugin/tests run {posargs} + find . -type f -name "*.pyc" -delete + stestr run '{posargs}' [testenv:flake8] commands = - flake8 {posargs} + flake8 {posargs} [flake8] show-source = True exclude = .git,.venv,.tox,dist,doc,*egg + +[testenv:scenario] +sitepackages = True +commands = + find . -type f -name "*.pyc" -delete + tempest run --serial --regex '(^whitebox_tempest_plugin\.tests\.scenario)' {posargs} diff --git a/whitebox_tempest_plugin/README.rst b/whitebox_tempest_plugin/README.rst new file mode 100644 index 00000000..0cb39ce7 --- /dev/null +++ b/whitebox_tempest_plugin/README.rst @@ -0,0 +1,10 @@ +====================== +Whitebox Tempest Tests +====================== + +This directory contains tests to validate behavior against +TripleO/Director-based deployments. + +See the Tempest plugin documentation for information about creating a plugin, +stable API interface, ``TempestPlugin`` class interface, plugin structure, and +how to use plugins: https://docs.openstack.org/tempest/latest/plugin.html diff --git a/whitebox_tempest_plugin/lib/__init__.py b/whitebox_tempest_plugin/tests/scenario/__init__.py similarity index 100% rename from whitebox_tempest_plugin/lib/__init__.py rename to whitebox_tempest_plugin/tests/scenario/__init__.py diff --git a/whitebox_tempest_plugin/base.py b/whitebox_tempest_plugin/tests/scenario/base.py similarity index 100% rename from whitebox_tempest_plugin/base.py rename to whitebox_tempest_plugin/tests/scenario/base.py diff --git a/whitebox_tempest_plugin/scenario/test_pointer_device_type.py b/whitebox_tempest_plugin/tests/scenario/test_pointer_device_type.py similarity index 98% rename from whitebox_tempest_plugin/scenario/test_pointer_device_type.py rename to whitebox_tempest_plugin/tests/scenario/test_pointer_device_type.py index 7ab94fe7..7089a38d 100644 --- a/whitebox_tempest_plugin/scenario/test_pointer_device_type.py +++ b/whitebox_tempest_plugin/tests/scenario/test_pointer_device_type.py @@ -27,8 +27,8 @@ from tempest.common.utils import data_utils from tempest import config from tempest import test -from whitebox_tempest_plugin import base from whitebox_tempest_plugin.services import clients +from whitebox_tempest_plugin.tests.scenario import base CONF = config.CONF LOG = logging.getLogger(__name__) diff --git a/whitebox_tempest_plugin/scenario/test_refresh_quota_usages.py b/whitebox_tempest_plugin/tests/scenario/test_refresh_quota_usages.py similarity index 98% rename from whitebox_tempest_plugin/scenario/test_refresh_quota_usages.py rename to whitebox_tempest_plugin/tests/scenario/test_refresh_quota_usages.py index 9a39786b..564b3789 100644 --- a/whitebox_tempest_plugin/scenario/test_refresh_quota_usages.py +++ b/whitebox_tempest_plugin/tests/scenario/test_refresh_quota_usages.py @@ -24,8 +24,8 @@ from tempest.common.utils import data_utils from tempest import config from tempest import test -from whitebox_tempest_plugin import base from whitebox_tempest_plugin.services import clients +from whitebox_tempest_plugin.tests.scenario import base CONF = config.CONF LOG = logging.getLogger(__name__) diff --git a/whitebox_tempest_plugin/scenario/__init__.py b/whitebox_tempest_plugin/tests/unit/__init__.py similarity index 100% rename from whitebox_tempest_plugin/scenario/__init__.py rename to whitebox_tempest_plugin/tests/unit/__init__.py diff --git a/whitebox_tempest_plugin/tests/base.py b/whitebox_tempest_plugin/tests/unit/base.py similarity index 100% rename from whitebox_tempest_plugin/tests/base.py rename to whitebox_tempest_plugin/tests/unit/base.py diff --git a/whitebox_tempest_plugin/tests/test_placeholder.py b/whitebox_tempest_plugin/tests/unit/test_placeholder.py similarity index 94% rename from whitebox_tempest_plugin/tests/test_placeholder.py rename to whitebox_tempest_plugin/tests/unit/test_placeholder.py index 39bd45a5..63f0df75 100644 --- a/whitebox_tempest_plugin/tests/test_placeholder.py +++ b/whitebox_tempest_plugin/tests/unit/test_placeholder.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from whitebox_tempest_plugin.tests import base +from whitebox_tempest_plugin.tests.unit import base class PlaceholderTestCase(base.WhiteboxPluginTestCase):