From 7b181981d9a823596b14ba8e482e31481c5a3a4f Mon Sep 17 00:00:00 2001 From: vponomaryov Date: Wed, 20 Apr 2016 13:51:14 +0300 Subject: [PATCH] Place all unit tests under single subdir Make all tests be under single subdir for ease of its usage. If possible, tests modules should follow following naming template: path/[tests]/to/[test_]module.py Change-Id: Id0a5f4aa72d01f43d0ae66659a6bc58a75857f75 Closes-Bug: #1499641 --- manila_ui/{test => tests}/__init__.py | 0 manila_ui/{test => tests}/api/__init__.py | 0 manila_ui/{test => tests}/api/test_manila.py | 2 +- manila_ui/{test => tests}/dashboards/__init__.py | 0 manila_ui/{test => tests}/dashboards/admin/__init__.py | 0 .../dashboards/admin/shares/__init__.py | 0 .../dashboards/admin/shares/test_forms.py | 2 +- manila_ui/{ => tests}/dashboards/admin/shares/tests.py | 4 ++-- .../{test => tests}/dashboards/project/__init__.py | 0 .../dashboards/project/shares/__init__.py | 0 .../project/shares/security_services}/__init__.py | 0 .../project/shares/security_services/tests.py | 4 ++-- .../project/shares/share_networks}/__init__.py | 0 .../dashboards/project/shares/share_networks/tests.py | 4 ++-- .../tests/dashboards/project/shares/shares/__init__.py | 0 .../dashboards/project/shares/shares/tests.py | 4 ++-- .../dashboards/project/shares/snapshots/__init__.py | 0 .../dashboards/project/shares/snapshots/test_tables.py | 2 +- .../dashboards/project/shares/snapshots/tests.py | 4 ++-- .../{ => tests}/dashboards/project/shares/test_data.py | 0 .../{ => tests}/dashboards/project/shares/tests.py | 4 ++-- manila_ui/{test => tests}/dashboards/test_utils.py | 2 +- manila_ui/{test => tests}/helpers.py | 2 +- manila_ui/{test => tests}/settings.py | 2 +- manila_ui/tests/test_data/__init__.py | 0 manila_ui/{test => tests}/test_data/keystone_data.py | 0 manila_ui/{test => tests}/test_data/utils.py | 2 +- manila_ui/{test => tests}/urls.py | 0 run_tests.sh | 10 +++++----- 29 files changed, 24 insertions(+), 24 deletions(-) rename manila_ui/{test => tests}/__init__.py (100%) rename manila_ui/{test => tests}/api/__init__.py (100%) rename manila_ui/{test => tests}/api/test_manila.py (98%) rename manila_ui/{test => tests}/dashboards/__init__.py (100%) rename manila_ui/{test => tests}/dashboards/admin/__init__.py (100%) rename manila_ui/{test => tests}/dashboards/admin/shares/__init__.py (100%) rename manila_ui/{test => tests}/dashboards/admin/shares/test_forms.py (99%) rename manila_ui/{ => tests}/dashboards/admin/shares/tests.py (98%) rename manila_ui/{test => tests}/dashboards/project/__init__.py (100%) rename manila_ui/{test => tests}/dashboards/project/shares/__init__.py (100%) rename manila_ui/{test/dashboards/project/shares/snapshots => tests/dashboards/project/shares/security_services}/__init__.py (100%) rename manila_ui/{ => tests}/dashboards/project/shares/security_services/tests.py (97%) rename manila_ui/{test/test_data => tests/dashboards/project/shares/share_networks}/__init__.py (100%) rename manila_ui/{ => tests}/dashboards/project/shares/share_networks/tests.py (98%) create mode 100644 manila_ui/tests/dashboards/project/shares/shares/__init__.py rename manila_ui/{ => tests}/dashboards/project/shares/shares/tests.py (98%) create mode 100644 manila_ui/tests/dashboards/project/shares/snapshots/__init__.py rename manila_ui/{test => tests}/dashboards/project/shares/snapshots/test_tables.py (98%) rename manila_ui/{ => tests}/dashboards/project/shares/snapshots/tests.py (97%) rename manila_ui/{ => tests}/dashboards/project/shares/test_data.py (100%) rename manila_ui/{ => tests}/dashboards/project/shares/tests.py (95%) rename manila_ui/{test => tests}/dashboards/test_utils.py (97%) rename manila_ui/{test => tests}/helpers.py (97%) rename manila_ui/{test => tests}/settings.py (99%) create mode 100644 manila_ui/tests/test_data/__init__.py rename manila_ui/{test => tests}/test_data/keystone_data.py (100%) rename manila_ui/{test => tests}/test_data/utils.py (93%) rename manila_ui/{test => tests}/urls.py (100%) diff --git a/manila_ui/test/__init__.py b/manila_ui/tests/__init__.py similarity index 100% rename from manila_ui/test/__init__.py rename to manila_ui/tests/__init__.py diff --git a/manila_ui/test/api/__init__.py b/manila_ui/tests/api/__init__.py similarity index 100% rename from manila_ui/test/api/__init__.py rename to manila_ui/tests/api/__init__.py diff --git a/manila_ui/test/api/test_manila.py b/manila_ui/tests/api/test_manila.py similarity index 98% rename from manila_ui/test/api/test_manila.py rename to manila_ui/tests/api/test_manila.py index 573daa29..adde82ed 100644 --- a/manila_ui/test/api/test_manila.py +++ b/manila_ui/tests/api/test_manila.py @@ -16,7 +16,7 @@ import ddt from manila_ui.api import manila as api -from manila_ui.test import helpers as base +from manila_ui.tests import helpers as base @ddt.ddt diff --git a/manila_ui/test/dashboards/__init__.py b/manila_ui/tests/dashboards/__init__.py similarity index 100% rename from manila_ui/test/dashboards/__init__.py rename to manila_ui/tests/dashboards/__init__.py diff --git a/manila_ui/test/dashboards/admin/__init__.py b/manila_ui/tests/dashboards/admin/__init__.py similarity index 100% rename from manila_ui/test/dashboards/admin/__init__.py rename to manila_ui/tests/dashboards/admin/__init__.py diff --git a/manila_ui/test/dashboards/admin/shares/__init__.py b/manila_ui/tests/dashboards/admin/shares/__init__.py similarity index 100% rename from manila_ui/test/dashboards/admin/shares/__init__.py rename to manila_ui/tests/dashboards/admin/shares/__init__.py diff --git a/manila_ui/test/dashboards/admin/shares/test_forms.py b/manila_ui/tests/dashboards/admin/shares/test_forms.py similarity index 99% rename from manila_ui/test/dashboards/admin/shares/test_forms.py rename to manila_ui/tests/dashboards/admin/shares/test_forms.py index 83ec8344..4e653851 100644 --- a/manila_ui/test/dashboards/admin/shares/test_forms.py +++ b/manila_ui/tests/dashboards/admin/shares/test_forms.py @@ -20,7 +20,7 @@ from horizon import forms as horizon_forms import mock from manila_ui.dashboards.admin.shares import forms -from manila_ui.test import helpers as base +from manila_ui.tests import helpers as base @ddt.ddt diff --git a/manila_ui/dashboards/admin/shares/tests.py b/manila_ui/tests/dashboards/admin/shares/tests.py similarity index 98% rename from manila_ui/dashboards/admin/shares/tests.py rename to manila_ui/tests/dashboards/admin/shares/tests.py index 3ef72bc2..6150e9b9 100644 --- a/manila_ui/dashboards/admin/shares/tests.py +++ b/manila_ui/tests/dashboards/admin/shares/tests.py @@ -16,8 +16,8 @@ from django.core.urlresolvers import reverse import mock from manila_ui.api import manila as api_manila -from manila_ui.dashboards.project.shares import test_data -from manila_ui.test import helpers as test +from manila_ui.tests.dashboards.project.shares import test_data +from manila_ui.tests import helpers as test from openstack_dashboard import api from openstack_dashboard.usage import quotas diff --git a/manila_ui/test/dashboards/project/__init__.py b/manila_ui/tests/dashboards/project/__init__.py similarity index 100% rename from manila_ui/test/dashboards/project/__init__.py rename to manila_ui/tests/dashboards/project/__init__.py diff --git a/manila_ui/test/dashboards/project/shares/__init__.py b/manila_ui/tests/dashboards/project/shares/__init__.py similarity index 100% rename from manila_ui/test/dashboards/project/shares/__init__.py rename to manila_ui/tests/dashboards/project/shares/__init__.py diff --git a/manila_ui/test/dashboards/project/shares/snapshots/__init__.py b/manila_ui/tests/dashboards/project/shares/security_services/__init__.py similarity index 100% rename from manila_ui/test/dashboards/project/shares/snapshots/__init__.py rename to manila_ui/tests/dashboards/project/shares/security_services/__init__.py diff --git a/manila_ui/dashboards/project/shares/security_services/tests.py b/manila_ui/tests/dashboards/project/shares/security_services/tests.py similarity index 97% rename from manila_ui/dashboards/project/shares/security_services/tests.py rename to manila_ui/tests/dashboards/project/shares/security_services/tests.py index 5d9f22ca..58c75c9d 100644 --- a/manila_ui/dashboards/project/shares/security_services/tests.py +++ b/manila_ui/tests/dashboards/project/shares/security_services/tests.py @@ -23,9 +23,9 @@ from manilaclient import exceptions as manila_client_exc import mock from manila_ui.api import manila as api_manila -from manila_ui.dashboards.project.shares import test_data +from manila_ui.tests.dashboards.project.shares import test_data -from manila_ui.test import helpers as test +from manila_ui.tests import helpers as test SHARE_INDEX_URL = reverse('horizon:project:shares:index') diff --git a/manila_ui/test/test_data/__init__.py b/manila_ui/tests/dashboards/project/shares/share_networks/__init__.py similarity index 100% rename from manila_ui/test/test_data/__init__.py rename to manila_ui/tests/dashboards/project/shares/share_networks/__init__.py diff --git a/manila_ui/dashboards/project/shares/share_networks/tests.py b/manila_ui/tests/dashboards/project/shares/share_networks/tests.py similarity index 98% rename from manila_ui/dashboards/project/shares/share_networks/tests.py rename to manila_ui/tests/dashboards/project/shares/share_networks/tests.py index cfee1669..419c66ee 100644 --- a/manila_ui/dashboards/project/shares/share_networks/tests.py +++ b/manila_ui/tests/dashboards/project/shares/share_networks/tests.py @@ -19,8 +19,8 @@ from neutronclient.client import exceptions from manila_ui.api import manila as api_manila from manila_ui.api import network as api_manila_network -from manila_ui.dashboards.project.shares import test_data -from manila_ui.test import helpers as test +from manila_ui.tests.dashboards.project.shares import test_data +from manila_ui.tests import helpers as test from openstack_dashboard import api diff --git a/manila_ui/tests/dashboards/project/shares/shares/__init__.py b/manila_ui/tests/dashboards/project/shares/shares/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/manila_ui/dashboards/project/shares/shares/tests.py b/manila_ui/tests/dashboards/project/shares/shares/tests.py similarity index 98% rename from manila_ui/dashboards/project/shares/shares/tests.py rename to manila_ui/tests/dashboards/project/shares/shares/tests.py index 0adbcbf7..297f2ae4 100644 --- a/manila_ui/dashboards/project/shares/shares/tests.py +++ b/manila_ui/tests/dashboards/project/shares/shares/tests.py @@ -16,8 +16,8 @@ from django.core.urlresolvers import reverse import mock from manila_ui.api import manila as api_manila -from manila_ui.dashboards.project.shares import test_data -from manila_ui.test import helpers as test +from manila_ui.tests.dashboards.project.shares import test_data +from manila_ui.tests import helpers as test from openstack_dashboard import api from openstack_dashboard.api import nova diff --git a/manila_ui/tests/dashboards/project/shares/snapshots/__init__.py b/manila_ui/tests/dashboards/project/shares/snapshots/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/manila_ui/test/dashboards/project/shares/snapshots/test_tables.py b/manila_ui/tests/dashboards/project/shares/snapshots/test_tables.py similarity index 98% rename from manila_ui/test/dashboards/project/shares/snapshots/test_tables.py rename to manila_ui/tests/dashboards/project/shares/snapshots/test_tables.py index 535baeb3..88c75959 100644 --- a/manila_ui/test/dashboards/project/shares/snapshots/test_tables.py +++ b/manila_ui/tests/dashboards/project/shares/snapshots/test_tables.py @@ -18,7 +18,7 @@ from django.core.handlers import wsgi import mock from manila_ui.dashboards.project.shares.snapshots import tables -from manila_ui.test import helpers as base +from manila_ui.tests import helpers as base @ddt.ddt diff --git a/manila_ui/dashboards/project/shares/snapshots/tests.py b/manila_ui/tests/dashboards/project/shares/snapshots/tests.py similarity index 97% rename from manila_ui/dashboards/project/shares/snapshots/tests.py rename to manila_ui/tests/dashboards/project/shares/snapshots/tests.py index ab582c58..52e3463b 100644 --- a/manila_ui/dashboards/project/shares/snapshots/tests.py +++ b/manila_ui/tests/dashboards/project/shares/snapshots/tests.py @@ -16,8 +16,8 @@ from django.core.urlresolvers import reverse import mock from manila_ui.api import manila as api_manila -from manila_ui.dashboards.project.shares import test_data -from manila_ui.test import helpers as test +from manila_ui.tests.dashboards.project.shares import test_data +from manila_ui.tests import helpers as test SHARE_INDEX_URL = reverse('horizon:project:shares:index') diff --git a/manila_ui/dashboards/project/shares/test_data.py b/manila_ui/tests/dashboards/project/shares/test_data.py similarity index 100% rename from manila_ui/dashboards/project/shares/test_data.py rename to manila_ui/tests/dashboards/project/shares/test_data.py diff --git a/manila_ui/dashboards/project/shares/tests.py b/manila_ui/tests/dashboards/project/shares/tests.py similarity index 95% rename from manila_ui/dashboards/project/shares/tests.py rename to manila_ui/tests/dashboards/project/shares/tests.py index 9604c83f..e55ea334 100644 --- a/manila_ui/dashboards/project/shares/tests.py +++ b/manila_ui/tests/dashboards/project/shares/tests.py @@ -16,8 +16,8 @@ from django.core.urlresolvers import reverse import mock from manila_ui.api import manila as api_manila -from manila_ui.dashboards.project.shares import test_data -from manila_ui.test import helpers as test +from manila_ui.tests.dashboards.project.shares import test_data +from manila_ui.tests import helpers as test from openstack_dashboard import api from openstack_dashboard.usage import quotas diff --git a/manila_ui/test/dashboards/test_utils.py b/manila_ui/tests/dashboards/test_utils.py similarity index 97% rename from manila_ui/test/dashboards/test_utils.py rename to manila_ui/tests/dashboards/test_utils.py index dcde6c95..21645b11 100644 --- a/manila_ui/test/dashboards/test_utils.py +++ b/manila_ui/tests/dashboards/test_utils.py @@ -17,7 +17,7 @@ import ddt from django.forms import ValidationError # noqa from manila_ui.dashboards import utils -from manila_ui.test import helpers as base +from manila_ui.tests import helpers as base @ddt.ddt diff --git a/manila_ui/test/helpers.py b/manila_ui/tests/helpers.py similarity index 97% rename from manila_ui/test/helpers.py rename to manila_ui/tests/helpers.py index 2f476e49..f63fc094 100644 --- a/manila_ui/test/helpers.py +++ b/manila_ui/tests/helpers.py @@ -17,7 +17,7 @@ from django.utils import unittest import mock from manila_ui import api -from manila_ui.test.test_data import utils +from manila_ui.tests.test_data import utils from openstack_dashboard.test import helpers diff --git a/manila_ui/test/settings.py b/manila_ui/tests/settings.py similarity index 99% rename from manila_ui/test/settings.py rename to manila_ui/tests/settings.py index 6f46d3b3..ebdbf969 100644 --- a/manila_ui/test/settings.py +++ b/manila_ui/tests/settings.py @@ -33,7 +33,7 @@ STATIC_URL = '/static/' SECRET_KEY = secret_key.generate_or_read_from_file( os.path.join(TEST_DIR, '.secret_key_store')) -ROOT_URLCONF = 'manila_ui.test.urls' +ROOT_URLCONF = 'manila_ui.tests.urls' TEMPLATE_DIRS = ( os.path.join(TEST_DIR, 'templates'), ) diff --git a/manila_ui/tests/test_data/__init__.py b/manila_ui/tests/test_data/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/manila_ui/test/test_data/keystone_data.py b/manila_ui/tests/test_data/keystone_data.py similarity index 100% rename from manila_ui/test/test_data/keystone_data.py rename to manila_ui/tests/test_data/keystone_data.py diff --git a/manila_ui/test/test_data/utils.py b/manila_ui/tests/test_data/utils.py similarity index 93% rename from manila_ui/test/test_data/utils.py rename to manila_ui/tests/test_data/utils.py index 6cf5521a..ede75a76 100644 --- a/manila_ui/test/test_data/utils.py +++ b/manila_ui/tests/test_data/utils.py @@ -15,7 +15,7 @@ from openstack_dashboard.test.test_data import utils def load_test_data(load_onto=None): - from manila_ui.test.test_data import keystone_data as manila_keystone_data + from manila_ui.tests.test_data import keystone_data as manila_keystone_data from openstack_dashboard.test.test_data import exceptions from openstack_dashboard.test.test_data import keystone_data diff --git a/manila_ui/test/urls.py b/manila_ui/tests/urls.py similarity index 100% rename from manila_ui/test/urls.py rename to manila_ui/tests/urls.py diff --git a/run_tests.sh b/run_tests.sh index 8cde6c44..df225bf6 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -165,7 +165,7 @@ function warn_on_flake8_without_venv { function run_pep8 { echo "Running flake8 ..." warn_on_flake8_without_venv - DJANGO_SETTINGS_MODULE=manila_ui.test.settings ${command_wrapper} flake8 + DJANGO_SETTINGS_MODULE=manila_ui.tests.settings ${command_wrapper} flake8 } function run_pep8_changed { @@ -178,13 +178,13 @@ function run_pep8_changed { files=$(git diff --name-only $base_commit | tr '\n' ' ') echo "Running flake8 on ${files}" warn_on_flake8_without_venv - diff -u --from-file /dev/null ${files} | DJANGO_SETTINGS_MODULE=manila_ui.test.settings ${command_wrapper} flake8 --diff + diff -u --from-file /dev/null ${files} | DJANGO_SETTINGS_MODULE=manila_ui.tests.settings ${command_wrapper} flake8 --diff exit } function run_sphinx { echo "Building sphinx..." - DJANGO_SETTINGS_MODULE=manila_ui.test.settings ${command_wrapper} python setup.py build_sphinx + DJANGO_SETTINGS_MODULE=manila_ui.tests.settings ${command_wrapper} python setup.py build_sphinx echo "Build complete." } @@ -331,7 +331,7 @@ function run_tests { function run_tests_subset { project=`echo $testargs | awk -F. '{print $1}'` - ${command_wrapper} python $root/manage.py test --settings=$project.test.settings $testopts $testargs + ${command_wrapper} python $root/manage.py test --settings=$project.tests.settings $testopts $testargs } function run_tests_all { @@ -344,7 +344,7 @@ function run_tests_all { ${command_wrapper} python -m coverage.__main__ erase coverage_run="python -m coverage.__main__ run -p" fi - ${command_wrapper} ${coverage_run} $root/manage.py test manila_ui --settings=manila_ui.test.settings $testopts + ${command_wrapper} ${coverage_run} $root/manage.py test manila_ui --settings=manila_ui.tests.settings $testopts # get results of the Horizon tests MANILA_UI_RESULT=$?