Setup test environment
This commit is contained in:
parent
16e8f151d7
commit
dc9ff338fe
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,2 +1,8 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
*.swp
|
*.swp
|
||||||
|
*.egg*/
|
||||||
|
.tox/
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
AUTHORS
|
||||||
|
ChangeLog
|
||||||
|
5
babel-django.cfg
Normal file
5
babel-django.cfg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[extractors]
|
||||||
|
django = django_babel.extract:extract_django
|
||||||
|
|
||||||
|
[python: **.py]
|
||||||
|
[django: templates/**.html]
|
14
babel-djangojs.cfg
Normal file
14
babel-djangojs.cfg
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[extractors]
|
||||||
|
# We use a custom extractor to find translatable strings in AngularJS
|
||||||
|
# templates. The extractor is included in horizon.utils for now.
|
||||||
|
# See http://babel.pocoo.org/docs/messages/#referencing-extraction-methods for
|
||||||
|
# details on how this works.
|
||||||
|
angular = horizon.utils.babel_extract_angular:extract_angular
|
||||||
|
|
||||||
|
[javascript: **.js]
|
||||||
|
|
||||||
|
# We need to look into all static folders for HTML files.
|
||||||
|
# The **/static ensures that we also search within
|
||||||
|
# /openstack_dashboard/dashboards/XYZ/static which will ensure
|
||||||
|
# that plugins are also translated.
|
||||||
|
[angular: **/static/**.html]
|
23
manage.py
Executable file
23
manage.py
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# 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
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from django.core.management import execute_from_command_line # noqa
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
|
||||||
|
"neutron_vpnaas_dashboard.test.settings")
|
||||||
|
execute_from_command_line(sys.argv)
|
0
neutron_vpnaas_dashboard/locale/.placeholder
Normal file
0
neutron_vpnaas_dashboard/locale/.placeholder
Normal file
@ -26,8 +26,8 @@ from openstack_dashboard.utils import settings
|
|||||||
|
|
||||||
settings.update_dashboards(
|
settings.update_dashboards(
|
||||||
[
|
[
|
||||||
neutron_vpnaas_dashboard.enabled,
|
|
||||||
openstack_dashboard.enabled,
|
openstack_dashboard.enabled,
|
||||||
|
neutron_vpnaas_dashboard.enabled,
|
||||||
],
|
],
|
||||||
HORIZON_CONFIG,
|
HORIZON_CONFIG,
|
||||||
INSTALLED_APPS
|
INSTALLED_APPS
|
||||||
|
22
test-requirements.txt
Normal file
22
test-requirements.txt
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
# Hacking should appear first in case something else depends on pep8
|
||||||
|
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||||
|
|
||||||
|
coverage!=4.4,>=4.0 # Apache-2.0
|
||||||
|
ddt>=1.0.1 # MIT
|
||||||
|
django-nose>=1.4.4 # BSD
|
||||||
|
mock>=2.0 # BSD
|
||||||
|
mox3!=0.19.0,>=0.7.0 # Apache-2.0
|
||||||
|
python-subunit>=0.0.18 # Apache-2.0/BSD
|
||||||
|
selenium>=2.50.1 # Apache-2.0
|
||||||
|
sphinx!=1.6.1,>=1.5.1 # BSD
|
||||||
|
oslosphinx>=4.7.0 # Apache-2.0
|
||||||
|
testrepository>=0.0.18 # Apache-2.0/BSD
|
||||||
|
testscenarios>=0.4 # Apache-2.0/BSD
|
||||||
|
testtools>=1.4.0 # MIT
|
||||||
|
# This also needs xvfb library installed on your OS
|
||||||
|
xvfbwrapper>=0.1.3 #license: MIT
|
||||||
|
reno>=1.8.0 # Apache-2.0
|
87
tools/tox_install.sh
Executable file
87
tools/tox_install.sh
Executable file
@ -0,0 +1,87 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Client constraint file contains this client version pin that is in conflict
|
||||||
|
# with installing the client from source. We should remove the version pin in
|
||||||
|
# the constraints file before applying it for from-source installation.
|
||||||
|
# The script also has a secondary purpose to install certain special
|
||||||
|
# dependencies directly from git.
|
||||||
|
|
||||||
|
# Wrapper for pip install that always uses constraints.
|
||||||
|
function pip_install() {
|
||||||
|
pip install -c"$localfile" -U "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Grab the library from git using either zuul-cloner or pip. The former is
|
||||||
|
# there to a take advantage of the setup done by the gate infrastructure
|
||||||
|
# and honour any/all Depends-On headers in the commit message
|
||||||
|
function install_from_git() {
|
||||||
|
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
|
||||||
|
GIT_HOST=git.openstack.org
|
||||||
|
PROJ=$1
|
||||||
|
EGG=$2
|
||||||
|
|
||||||
|
edit-constraints "$localfile" -- "$EGG"
|
||||||
|
if [ -x "$ZUUL_CLONER" ]; then
|
||||||
|
SRC_DIR="$VIRTUAL_ENV/src"
|
||||||
|
mkdir -p "$SRC_DIR"
|
||||||
|
cd "$SRC_DIR" >/dev/null
|
||||||
|
ZUUL_CACHE_DIR=${ZUUL_CACHE_DIR:-/opt/git} $ZUUL_CLONER \
|
||||||
|
--branch "$BRANCH_NAME" \
|
||||||
|
"git://$GIT_HOST" "$PROJ"
|
||||||
|
pip_install -e "$PROJ/."
|
||||||
|
cd - >/dev/null
|
||||||
|
else
|
||||||
|
SRC_DIR="$VIRTUAL_ENV/src/$PROJ"
|
||||||
|
git clone --depth 1 --branch $BRANCH_NAME https://$GIT_HOST/$PROJ $SRC_DIR
|
||||||
|
pip_install -e $SRC_DIR
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CONSTRAINTS_FILE="$1"
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
# This script will either complete with a return code of 0 or the return code
|
||||||
|
# of whatever failed.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# NOTE(tonyb): Place this in the tox environment's log dir so it will get
|
||||||
|
# published to logs.openstack.org for easy debugging.
|
||||||
|
mkdir -p "$VIRTUAL_ENV/log/"
|
||||||
|
localfile="$VIRTUAL_ENV/log/upper-constraints.txt"
|
||||||
|
|
||||||
|
if [[ "$CONSTRAINTS_FILE" != http* ]]; then
|
||||||
|
CONSTRAINTS_FILE="file://$CONSTRAINTS_FILE"
|
||||||
|
fi
|
||||||
|
# NOTE(tonyb): need to add curl to bindep.txt if the project supports bindep
|
||||||
|
curl "$CONSTRAINTS_FILE" --insecure --progress-bar --output "$localfile"
|
||||||
|
|
||||||
|
pip_install openstack-requirements
|
||||||
|
|
||||||
|
# This is the main purpose of the script: Allow local installation of
|
||||||
|
# the current repo. It is listed in constraints file and thus any
|
||||||
|
# install will be constrained and we need to unconstrain it.
|
||||||
|
edit-constraints "$localfile" -- "$CLIENT_NAME"
|
||||||
|
|
||||||
|
declare -a passthrough_args
|
||||||
|
while [ $# -gt 0 ] ; do
|
||||||
|
case "$1" in
|
||||||
|
# If we have any special os:<repo_name:<egg_name> deps then process them
|
||||||
|
os:*)
|
||||||
|
declare -a pkg_spec
|
||||||
|
IFS=: pkg_spec=($1)
|
||||||
|
install_from_git "${pkg_spec[1]}" "${pkg_spec[2]}"
|
||||||
|
;;
|
||||||
|
# Otherwise just pass the other deps through to the constrained pip install
|
||||||
|
*)
|
||||||
|
passthrough_args+=("$1")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# If *only* had special args then then isn't any need to run pip.
|
||||||
|
if [ -n "$passthrough_args" ] ; then
|
||||||
|
pip_install "${passthrough_args[@]}"
|
||||||
|
fi
|
95
tox.ini
Normal file
95
tox.ini
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
[tox]
|
||||||
|
envlist = py34,py27,py27dj18,pep8
|
||||||
|
minversion = 2.0
|
||||||
|
skipsdist = True
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
usedevelop = True
|
||||||
|
install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
||||||
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
|
BRANCH_NAME=master
|
||||||
|
CLIENT_NAME=neutron-vpnaas-dashboard
|
||||||
|
NOSE_WITH_OPENSTACK=1
|
||||||
|
NOSE_OPENSTACK_COLOR=1
|
||||||
|
NOSE_OPENSTACK_RED=0.05
|
||||||
|
NOSE_OPENSTACK_YELLOW=0.025
|
||||||
|
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
||||||
|
deps = -r{toxinidir}/requirements.txt
|
||||||
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
os:openstack/horizon:horizon
|
||||||
|
commands = python manage.py test {posargs} --settings=neutron_vpnaas_dashboard.test.settings
|
||||||
|
|
||||||
|
[testenv:pep8]
|
||||||
|
commands =
|
||||||
|
flake8 {posargs}
|
||||||
|
{envpython} {toxinidir}/manage.py extract_messages --module neutron_vpnaas_dashboard --verbosity 0 --check-only
|
||||||
|
|
||||||
|
[testenv:venv]
|
||||||
|
commands = {posargs}
|
||||||
|
|
||||||
|
[testenv:cover]
|
||||||
|
commands =
|
||||||
|
coverage erase
|
||||||
|
coverage run {toxinidir}/manage.py test neutron_vpnaas_dashboard --settings=neutron_vpnaas_dashboard.test.settings {posargs} --exclude-dir=neutron_vpnaas_dashboard/test/integration_tests {posargs}
|
||||||
|
coverage xml --omit '.tox/cover/*' -o 'cover/coverage.xml'
|
||||||
|
coverage html --omit '.tox/cover/*' -d 'cover/htmlcov'
|
||||||
|
|
||||||
|
[testenv:py27dj18]
|
||||||
|
basepython = python2.7
|
||||||
|
commands =
|
||||||
|
pip install django>=1.8,<1.9
|
||||||
|
python manage.py test {posargs} --settings=neutron_vpnaas_dashboard.test.settings
|
||||||
|
|
||||||
|
[testenv:eslint]
|
||||||
|
whitelist_externals = npm
|
||||||
|
commands =
|
||||||
|
npm install
|
||||||
|
npm run postinstall
|
||||||
|
npm run lint
|
||||||
|
|
||||||
|
[testenv:karma]
|
||||||
|
# NOTE(shu-mutou): Until PhantomJS setup get reliable, we use
|
||||||
|
# Chromium for JS test. And npm can't launch Chromium via tox.
|
||||||
|
#whitelist_externals = npm
|
||||||
|
#commands =
|
||||||
|
# npm install
|
||||||
|
# npm run postinstall
|
||||||
|
# npm run test
|
||||||
|
whitelist_externals = echo
|
||||||
|
commands =
|
||||||
|
echo "npm can't launch Chromium via tox."
|
||||||
|
echo "nexecute `npm run test`"
|
||||||
|
|
||||||
|
[testenv:docs]
|
||||||
|
setenv = DJANGO_SETTINGS_MODULE=neutron_vpnaas_dashboard.test.settings
|
||||||
|
commands = python setup.py build_sphinx
|
||||||
|
|
||||||
|
[testenv:releasenotes]
|
||||||
|
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,node_modules
|
||||||
|
max-complexity = 20
|
||||||
|
|
||||||
|
[hacking]
|
||||||
|
import_exceptions = collections.defaultdict,
|
||||||
|
django.conf.settings,
|
||||||
|
django.conf.urls.include,
|
||||||
|
django.conf.urls.patterns,
|
||||||
|
django.conf.urls.url,
|
||||||
|
django.core.urlresolvers.reverse,
|
||||||
|
django.core.urlresolvers.reverse_lazy,
|
||||||
|
django.template.loader.render_to_string,
|
||||||
|
django.test.utils.override_settings,
|
||||||
|
django.utils.datastructures.SortedDict,
|
||||||
|
django.utils.encoding.force_text,
|
||||||
|
django.utils.html.conditional_escape,
|
||||||
|
django.utils.html.escape,
|
||||||
|
django.utils.http.urlencode,
|
||||||
|
django.utils.safestring.mark_safe,
|
||||||
|
django.utils.translation.npgettext_lazy,
|
||||||
|
django.utils.translation.pgettext_lazy,
|
||||||
|
django.utils.translation.ugettext_lazy,
|
||||||
|
django.utils.translation.ungettext_lazy,
|
||||||
|
operator.attrgetter,
|
||||||
|
StringIO.StringIO
|
Loading…
Reference in New Issue
Block a user