Setup unit test framework
Added capability to run test and pep8. Change-Id: I0f45d9b5b6a6cd22a99395a12e56433539f561b6 Closes-bug: #1527406
This commit is contained in:
parent
c8305bec51
commit
d580bf8538
11
manage.py
Executable file
11
manage.py
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
|
||||
"openstack_dashboard.settings")
|
||||
execute_from_command_line(sys.argv)
|
10
requirements.txt
Normal file
10
requirements.txt
Normal file
@ -0,0 +1,10 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
# Order matters to the pip dependency resolver, so sorting this file
|
||||
# changes how packages are installed. New dependencies should be
|
||||
# added in alphabetical order, however, some dependencies may need to
|
||||
# be installed in a specific order.
|
||||
#
|
||||
# PBR should always appear first
|
||||
pbr>=1.6
|
@ -13,7 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
from horizon.test import helpers as test
|
||||
from openstack_dashboard.test import helpers as test
|
||||
|
||||
|
||||
class VnfcatalogTests(test.TestCase):
|
||||
|
@ -13,7 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
from horizon.test import helpers as test
|
||||
from openstack_dashboard.test import helpers as test
|
||||
|
||||
|
||||
class VnfmanagerTests(test.TestCase):
|
||||
|
0
tacker_horizon/test/__init__.py
Normal file
0
tacker_horizon/test/__init__.py
Normal file
58
tacker_horizon/test/settings.py
Normal file
58
tacker_horizon/test/settings.py
Normal file
@ -0,0 +1,58 @@
|
||||
# Copyright (C) 2015 Yahoo! Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
|
||||
from horizon.test.settings import * # noqa
|
||||
from horizon.utils import secret_key as secret_key_utils
|
||||
from openstack_dashboard.test.settings import * # noqa
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
ROOT_PATH = os.path.abspath(os.path.join(TEST_DIR, ".."))
|
||||
|
||||
MEDIA_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'media'))
|
||||
MEDIA_URL = '/media/'
|
||||
STATIC_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'static'))
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
SECRET_KEY = secret_key_utils.generate_or_read_from_file(
|
||||
os.path.join(TEST_DIR, '.secret_key_store'))
|
||||
ROOT_URLCONF = 'tacker_horizon.test.urls'
|
||||
TEMPLATE_DIRS = (
|
||||
os.path.join(TEST_DIR, 'templates'),
|
||||
)
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.humanize',
|
||||
'django_nose',
|
||||
'openstack_auth',
|
||||
'compressor',
|
||||
'horizon',
|
||||
'openstack_dashboard',
|
||||
'tacker_horizon',
|
||||
)
|
||||
|
||||
NOSE_ARGS = ['--nocapture',
|
||||
'--nologcapture',
|
||||
'--cover-package=tacker_horizon',
|
||||
'--cover-inclusive',
|
||||
'--all-modules']
|
23
tacker_horizon/test/urls.py
Normal file
23
tacker_horizon/test/urls.py
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (C) 2015 Yahoo! Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.conf import urls
|
||||
from django.views import generic
|
||||
|
||||
import openstack_dashboard.urls
|
||||
|
||||
urlpatterns = urls.patterns(
|
||||
'',
|
||||
urls.url(r'', urls.include(openstack_dashboard.urls))
|
||||
)
|
@ -1,10 +1,31 @@
|
||||
unittest2
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
# Order matters to the pip dependency resolver, so sorting this file
|
||||
# changes how packages are installed. New dependencies should be
|
||||
# added in alphabetical order, however, some dependencies may need to
|
||||
# be installed in a specific order.
|
||||
#
|
||||
# Hacking should appear first in case something else depends on pep8
|
||||
hacking<0.11,>=0.10.0
|
||||
# Testing Requirements
|
||||
http://tarballs.openstack.org/horizon/horizon-master.tar.gz#egg=horizon
|
||||
http://tarballs.openstack.org/python-tackerclient/python-tackerclient-master.tar.gz#egg=python-tackerclient
|
||||
#
|
||||
coverage>=3.6
|
||||
django-nose>=1.2
|
||||
mock>=1.2
|
||||
mox3>=0.7.0
|
||||
nodeenv>=0.9.4 # BSD License
|
||||
nose
|
||||
coverage
|
||||
mock>=0.8.0
|
||||
pep8
|
||||
eventlet==0.12.1
|
||||
iso8601
|
||||
mox==0.5.3
|
||||
testtools
|
||||
fixtures
|
||||
nose-exclude
|
||||
nosehtmloutput>=0.0.3
|
||||
nosexcover
|
||||
openstack.nose-plugin>=0.7
|
||||
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
|
||||
reno>=0.1.1 # Apache2
|
||||
selenium
|
||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||
testtools>=1.4.0
|
||||
# This also needs xvfb library installed on your OS
|
||||
xvfbwrapper>=0.1.3 #license: MIT
|
||||
|
53
tox.ini
53
tox.ini
@ -1,23 +1,37 @@
|
||||
[tox]
|
||||
envlist = py27,pep8
|
||||
minversion = 1.6
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
distribute = False
|
||||
basepython=python2.7
|
||||
usedevelop = True
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = nosetests --with-coverage {posargs}
|
||||
sitepackages = False
|
||||
# Note the hash seed is set to 0 until horizon can be tested with a
|
||||
# random hash seed successfully.
|
||||
# PYTHONHASHSEED=0
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
{envpython} {toxinidir}/manage.py test tacker_horizon --settings=tacker_horizon.test.settings {posargs}
|
||||
|
||||
[testenv:py27]
|
||||
commands =
|
||||
{envpython} {toxinidir}/manage.py test tacker_horizon --settings=tacker_horizon.test.settings {posargs}
|
||||
|
||||
[tox:jenkins]
|
||||
|
||||
[testenv:style]
|
||||
deps = flake8
|
||||
setuptools_git>=0.4
|
||||
commands = flake8 setup.py
|
||||
|
||||
[testenv:pep8]
|
||||
deps = {[testenv:style]deps}
|
||||
commands = {[testenv:style]commands}
|
||||
usedevelop = True
|
||||
whitelist_externals =
|
||||
git
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
DJANGO_SETTINGS_MODULE=tacker_horizon.test.settings
|
||||
commands =
|
||||
flake8
|
||||
|
||||
[testenv:doc]
|
||||
deps = Sphinx
|
||||
@ -30,4 +44,19 @@ setenv = NOSE_WITH_COVERAGE=1
|
||||
commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
ignore = E123,E133,E226,E241,E242,E731
|
||||
# E127 continuation line over-indented for visual indent
|
||||
# E128 continuation line under-indented for visual indent
|
||||
# E201 whitespace after '{'
|
||||
# E225 missing whitespace around operator
|
||||
# E231 missing whitespace after ','
|
||||
# E265 block comment should start with '# '
|
||||
# E302 expected 2 blank lines, found 1
|
||||
# E303 too many blank lines (3)
|
||||
# E501 line too long (94 > 79 characters)
|
||||
# H101 Use TODO(NAME)
|
||||
# H238 old style class declaration, use new style (inherit from `object`)
|
||||
# H306 imports not in alphabetical order
|
||||
# H701 Empty localization string
|
||||
# F401 imported but unused
|
||||
# E502 the backslash is redundant between brackets
|
||||
ignore = E123,E127,E128,E133,E201,E225,E226,E231,E241,E242,E265,E302,E303,E501,E502,E731,H101,H238,H306,H701,F401
|
||||
|
Loading…
Reference in New Issue
Block a user