diff --git a/functionaltests/run_tests.sh b/functionaltests/run_tests.sh index 8c00fee4..7a7a214f 100644 --- a/functionaltests/run_tests.sh +++ b/functionaltests/run_tests.sh @@ -28,4 +28,4 @@ TEMPEST_DIR=${TEMPEST_DIR:-/opt/stack/new/tempest} # Add tempest source tree to PYTHONPATH export PYTHONPATH=$PYTHONPATH:$TEMPEST_DIR -nosetests -sv functionaltests +nosetests -sv mistralclient/tests/functional/ diff --git a/functionaltests/__init__.py b/mistralclient/tests/functional/__init__.py similarity index 100% rename from functionaltests/__init__.py rename to mistralclient/tests/functional/__init__.py diff --git a/functionaltests/cli/__init__.py b/mistralclient/tests/functional/cli/__init__.py similarity index 100% rename from functionaltests/cli/__init__.py rename to mistralclient/tests/functional/cli/__init__.py diff --git a/mistralclient/tests/functional/cli/v1/__init__.py b/mistralclient/tests/functional/cli/v1/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/functionaltests/cli/cli_tests.py b/mistralclient/tests/functional/cli/v1/cli_tests.py similarity index 100% rename from functionaltests/cli/cli_tests.py rename to mistralclient/tests/functional/cli/v1/cli_tests.py diff --git a/mistralclient/tests/functional/client/__init__.py b/mistralclient/tests/functional/client/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/mistralclient/tests/functional/client/v1/__init__.py b/mistralclient/tests/functional/client/v1/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/functionaltests/base.py b/mistralclient/tests/functional/client/v1/base.py similarity index 90% rename from functionaltests/base.py rename to mistralclient/tests/functional/client/v1/base.py index fd571725..fe29b435 100644 --- a/functionaltests/base.py +++ b/mistralclient/tests/functional/client/v1/base.py @@ -25,11 +25,8 @@ class MistralBase(testtools.TestCase): mgr = clients.Manager() cls.mistral_client = ClientAuth(mgr.auth_provider).mistral_client - __location = os.path.realpath(os.path.join(os.getcwd(), - os.path.dirname(__file__))) - - cls.definition = open(os.path.join( - __location, 'hello.yaml'), 'rb').read() + cls.definition = open(os.path.relpath( + 'functionaltests/hello.yaml', os.getcwd()), 'rb').read() cls.wb = cls.mistral_client.workbooks.create( "wb", "Description", ["tags"]) diff --git a/functionaltests/tests.py b/mistralclient/tests/functional/client/v1/tests.py similarity index 100% rename from functionaltests/tests.py rename to mistralclient/tests/functional/client/v1/tests.py diff --git a/mistralclient/tests/unit/__init__.py b/mistralclient/tests/unit/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/mistralclient/tests/base.py b/mistralclient/tests/unit/base.py similarity index 100% rename from mistralclient/tests/base.py rename to mistralclient/tests/unit/base.py diff --git a/mistralclient/tests/resources/ctx.json b/mistralclient/tests/unit/resources/ctx.json similarity index 100% rename from mistralclient/tests/resources/ctx.json rename to mistralclient/tests/unit/resources/ctx.json diff --git a/mistralclient/tests/test_cli_executions.py b/mistralclient/tests/unit/test_cli_executions.py similarity index 96% rename from mistralclient/tests/test_cli_executions.py rename to mistralclient/tests/unit/test_cli_executions.py index e99add6f..7ee659f8 100644 --- a/mistralclient/tests/test_cli_executions.py +++ b/mistralclient/tests/unit/test_cli_executions.py @@ -18,7 +18,7 @@ import pkg_resources as pkg import mock -from mistralclient.tests import base +from mistralclient.tests.unit import base from mistralclient.commands import executions from mistralclient.api.executions import Execution @@ -44,7 +44,7 @@ class TestCLIExecutions(base.BaseCommandTest): def test_create_ctx_file(self, mock): mock.return_value = EXECUTION path = pkg.resource_filename('mistralclient', - 'tests/resources/ctx.json') + 'tests/unit/resources/ctx.json') result = self.call(executions.Create, app_args=['name', 'id', path]) diff --git a/mistralclient/tests/test_cli_tasks.py b/mistralclient/tests/unit/test_cli_tasks.py similarity index 97% rename from mistralclient/tests/test_cli_tasks.py rename to mistralclient/tests/unit/test_cli_tasks.py index 47b72218..c52401fa 100644 --- a/mistralclient/tests/test_cli_tasks.py +++ b/mistralclient/tests/unit/test_cli_tasks.py @@ -16,7 +16,7 @@ import mock -from mistralclient.tests import base +from mistralclient.tests.unit import base from mistralclient.commands import tasks from mistralclient.api.tasks import Task diff --git a/mistralclient/tests/test_cli_workbooks.py b/mistralclient/tests/unit/test_cli_workbooks.py similarity index 98% rename from mistralclient/tests/test_cli_workbooks.py rename to mistralclient/tests/unit/test_cli_workbooks.py index b411134d..4d820d7f 100644 --- a/mistralclient/tests/test_cli_workbooks.py +++ b/mistralclient/tests/unit/test_cli_workbooks.py @@ -16,7 +16,7 @@ import mock -from mistralclient.tests import base +from mistralclient.tests.unit import base from mistralclient.commands import workbooks from mistralclient.api.workbooks import Workbook diff --git a/mistralclient/tests/test_executions.py b/mistralclient/tests/unit/test_executions.py similarity index 99% rename from mistralclient/tests/test_executions.py rename to mistralclient/tests/unit/test_executions.py index 5c81c95a..ab7df881 100644 --- a/mistralclient/tests/test_executions.py +++ b/mistralclient/tests/unit/test_executions.py @@ -15,7 +15,7 @@ import unittest2 import json -from mistralclient.tests import base +from mistralclient.tests.unit import base from mistralclient.api.executions import Execution # TODO: Later we need additional tests verifying all the errors etc. diff --git a/mistralclient/tests/test_listeners.py b/mistralclient/tests/unit/test_listeners.py similarity index 98% rename from mistralclient/tests/test_listeners.py rename to mistralclient/tests/unit/test_listeners.py index 2a6b371d..7ce951d8 100644 --- a/mistralclient/tests/test_listeners.py +++ b/mistralclient/tests/unit/test_listeners.py @@ -14,7 +14,7 @@ import json -from mistralclient.tests import base +from mistralclient.tests.unit import base from mistralclient.api.listeners import Listener # TODO: later we need additional tests verifying all the errors etc. diff --git a/mistralclient/tests/test_tasks.py b/mistralclient/tests/unit/test_tasks.py similarity index 98% rename from mistralclient/tests/test_tasks.py rename to mistralclient/tests/unit/test_tasks.py index 31a7b64b..51b78f77 100644 --- a/mistralclient/tests/test_tasks.py +++ b/mistralclient/tests/unit/test_tasks.py @@ -14,7 +14,7 @@ import json -from mistralclient.tests import base +from mistralclient.tests.unit import base from mistralclient.api.tasks import Task # TODO: later we need additional tests verifying all the errors etc. diff --git a/mistralclient/tests/test_workbooks.py b/mistralclient/tests/unit/test_workbooks.py similarity index 99% rename from mistralclient/tests/test_workbooks.py rename to mistralclient/tests/unit/test_workbooks.py index 3c7f3650..da32ceee 100644 --- a/mistralclient/tests/test_workbooks.py +++ b/mistralclient/tests/unit/test_workbooks.py @@ -14,7 +14,7 @@ import json -from mistralclient.tests import base +from mistralclient.tests.unit import base from mistralclient.api.workbooks import Workbook # TODO: later we need additional tests verifying all the errors etc. diff --git a/tox.ini b/tox.ini index a8657cc4..ed858c38 100644 --- a/tox.ini +++ b/tox.ini @@ -15,11 +15,11 @@ setenv = NOSE_OPENSTACK_SHOW_ELAPSED=1 NOSE_OPENSTACK_STDOUT=1 NOSE_XUNIT=1 - DISCOVER_DIRECTORY=mistralclient/tests + DISCOVER_DIRECTORY=mistralclient/tests/unit deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = nosetests mistralclient/tests +commands = nosetests mistralclient/tests/unit [testenv:pep8] commands = flake8 {posargs}