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
This commit is contained in:
parent
b27c49d034
commit
7b181981d9
@ -16,7 +16,7 @@
|
|||||||
import ddt
|
import ddt
|
||||||
|
|
||||||
from manila_ui.api import manila as api
|
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
|
@ddt.ddt
|
@ -20,7 +20,7 @@ from horizon import forms as horizon_forms
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from manila_ui.dashboards.admin.shares import forms
|
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
|
@ddt.ddt
|
@ -16,8 +16,8 @@ from django.core.urlresolvers import reverse
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from manila_ui.api import manila as api_manila
|
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
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
from openstack_dashboard.usage import quotas
|
from openstack_dashboard.usage import quotas
|
@ -23,9 +23,9 @@ from manilaclient import exceptions as manila_client_exc
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from manila_ui.api import manila as api_manila
|
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')
|
SHARE_INDEX_URL = reverse('horizon:project:shares:index')
|
@ -19,8 +19,8 @@ from neutronclient.client import exceptions
|
|||||||
|
|
||||||
from manila_ui.api import manila as api_manila
|
from manila_ui.api import manila as api_manila
|
||||||
from manila_ui.api import network as api_manila_network
|
from manila_ui.api import network as api_manila_network
|
||||||
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
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
|
|
@ -16,8 +16,8 @@ from django.core.urlresolvers import reverse
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from manila_ui.api import manila as api_manila
|
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
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
from openstack_dashboard.api import nova
|
from openstack_dashboard.api import nova
|
@ -18,7 +18,7 @@ from django.core.handlers import wsgi
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from manila_ui.dashboards.project.shares.snapshots import tables
|
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
|
@ddt.ddt
|
@ -16,8 +16,8 @@ from django.core.urlresolvers import reverse
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from manila_ui.api import manila as api_manila
|
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')
|
SHARE_INDEX_URL = reverse('horizon:project:shares:index')
|
@ -16,8 +16,8 @@ from django.core.urlresolvers import reverse
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from manila_ui.api import manila as api_manila
|
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
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
from openstack_dashboard.usage import quotas
|
from openstack_dashboard.usage import quotas
|
@ -17,7 +17,7 @@ import ddt
|
|||||||
from django.forms import ValidationError # noqa
|
from django.forms import ValidationError # noqa
|
||||||
|
|
||||||
from manila_ui.dashboards import utils
|
from manila_ui.dashboards import utils
|
||||||
from manila_ui.test import helpers as base
|
from manila_ui.tests import helpers as base
|
||||||
|
|
||||||
|
|
||||||
@ddt.ddt
|
@ddt.ddt
|
@ -17,7 +17,7 @@ from django.utils import unittest
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from manila_ui import api
|
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
|
from openstack_dashboard.test import helpers
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ STATIC_URL = '/static/'
|
|||||||
|
|
||||||
SECRET_KEY = secret_key.generate_or_read_from_file(
|
SECRET_KEY = secret_key.generate_or_read_from_file(
|
||||||
os.path.join(TEST_DIR, '.secret_key_store'))
|
os.path.join(TEST_DIR, '.secret_key_store'))
|
||||||
ROOT_URLCONF = 'manila_ui.test.urls'
|
ROOT_URLCONF = 'manila_ui.tests.urls'
|
||||||
TEMPLATE_DIRS = (
|
TEMPLATE_DIRS = (
|
||||||
os.path.join(TEST_DIR, 'templates'),
|
os.path.join(TEST_DIR, 'templates'),
|
||||||
)
|
)
|
0
manila_ui/tests/test_data/__init__.py
Normal file
0
manila_ui/tests/test_data/__init__.py
Normal file
@ -15,7 +15,7 @@ from openstack_dashboard.test.test_data import utils
|
|||||||
|
|
||||||
|
|
||||||
def load_test_data(load_onto=None):
|
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 exceptions
|
||||||
from openstack_dashboard.test.test_data import keystone_data
|
from openstack_dashboard.test.test_data import keystone_data
|
||||||
|
|
10
run_tests.sh
10
run_tests.sh
@ -165,7 +165,7 @@ function warn_on_flake8_without_venv {
|
|||||||
function run_pep8 {
|
function run_pep8 {
|
||||||
echo "Running flake8 ..."
|
echo "Running flake8 ..."
|
||||||
warn_on_flake8_without_venv
|
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 {
|
function run_pep8_changed {
|
||||||
@ -178,13 +178,13 @@ function run_pep8_changed {
|
|||||||
files=$(git diff --name-only $base_commit | tr '\n' ' ')
|
files=$(git diff --name-only $base_commit | tr '\n' ' ')
|
||||||
echo "Running flake8 on ${files}"
|
echo "Running flake8 on ${files}"
|
||||||
warn_on_flake8_without_venv
|
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
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_sphinx {
|
function run_sphinx {
|
||||||
echo "Building 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."
|
echo "Build complete."
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,7 +331,7 @@ function run_tests {
|
|||||||
|
|
||||||
function run_tests_subset {
|
function run_tests_subset {
|
||||||
project=`echo $testargs | awk -F. '{print $1}'`
|
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 {
|
function run_tests_all {
|
||||||
@ -344,7 +344,7 @@ function run_tests_all {
|
|||||||
${command_wrapper} python -m coverage.__main__ erase
|
${command_wrapper} python -m coverage.__main__ erase
|
||||||
coverage_run="python -m coverage.__main__ run -p"
|
coverage_run="python -m coverage.__main__ run -p"
|
||||||
fi
|
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
|
# get results of the Horizon tests
|
||||||
MANILA_UI_RESULT=$?
|
MANILA_UI_RESULT=$?
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user