Install Horizon from git repository in tox test
To test UI plugins, we should install recent Horizon from master branch. Also, fixed eslint and karma. To run tox test easily before upload patchset, adds eslint, karma, docs and releasenotes to envlist. Change-Id: Ieb53598390f81ca684106f369b5e3bc175c6754e
This commit is contained in:
parent
aba06533b0
commit
6dada7b67f
26
package.json
26
package.json
|
@ -6,20 +6,22 @@
|
|||
"repository": "none",
|
||||
"license": "Apache 2.0",
|
||||
"devDependencies": {
|
||||
"eslint": "1.10.3",
|
||||
"eslint-config-openstack": "1.2.4",
|
||||
"eslint-plugin-angular": "1.0.1",
|
||||
"jasmine-core": "2.4.1",
|
||||
"karma": "1.1.2",
|
||||
"karma-chrome-launcher": "1.0.1",
|
||||
"karma-cli": "1.0.1",
|
||||
"karma-coverage": "1.1.1",
|
||||
"karma-jasmine": "1.0.2",
|
||||
"karma-ng-html2js-preprocessor": "1.0.0",
|
||||
"karma-threshold-reporter": "0.1.15"
|
||||
"eslint": "3.19.x",
|
||||
"eslint-config-openstack": "^4.0.1",
|
||||
"eslint-plugin-angular": "3.1.x",
|
||||
"jasmine-core": "2.8.x",
|
||||
"karma": "1.7.x",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-cli": "1.0.x",
|
||||
"karma-coverage": "1.1.x",
|
||||
"karma-jasmine": "1.1.x",
|
||||
"karma-ng-html2js-preprocessor": "1.0.x",
|
||||
"karma-phantomjs-launcher": "1.0.x",
|
||||
"karma-threshold-reporter": "0.1.x",
|
||||
"phantomjs-prebuilt": "2.1.x"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "if [ ! -d .tox ]; then tox -epy27 --notest; fi",
|
||||
"postinstall": "if [ ! -d .tox ] || [ ! -d .tox/karma ]; then tox -ekarma --notest; git clone https://git.openstack.org/openstack/horizon.git .tox/karma/src/horizon; pip install -U -t .tox/karma/lib/python2.7/site-packages/ .tox/karma/src/horizon; fi",
|
||||
"test": "karma start senlin_dashboard/karma.conf.js --single-run",
|
||||
"lint": "eslint --no-color senlin_dashboard/static"
|
||||
},
|
||||
|
|
|
@ -19,7 +19,9 @@ var path = require('path');
|
|||
|
||||
module.exports = function (config) {
|
||||
// This tox venv is setup in the post-install npm step
|
||||
var toxPath = '../.tox/py27/lib/python2.7/site-packages/';
|
||||
var toxPath = '../.tox/karma/lib/python2.7/site-packages/';
|
||||
|
||||
process.env.PHANTOMJS_BIN = 'node_modules/phantomjs-prebuilt/bin/phantomjs';
|
||||
|
||||
config.set({
|
||||
preprocessors: {
|
||||
|
@ -68,7 +70,7 @@ module.exports = function (config) {
|
|||
toxPath + 'xstatic/pkg/angular_schema_form/data/schema-form.js',
|
||||
|
||||
// TODO: These should be mocked.
|
||||
toxPath + '/horizon/static/horizon/js/horizon.js',
|
||||
toxPath + 'horizon/static/horizon/js/horizon.js',
|
||||
|
||||
/**
|
||||
* Include framework source code from horizon that we need.
|
||||
|
@ -120,7 +122,8 @@ module.exports = function (config) {
|
|||
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
browsers: ['Chrome'],
|
||||
// browsers: ['Chrome'],
|
||||
browsers: ['PhantomJS'],
|
||||
|
||||
phantomjsLauncher: {
|
||||
// Have phantomjs exit if a ResourceError is encountered
|
||||
|
@ -132,6 +135,7 @@ module.exports = function (config) {
|
|||
|
||||
plugins: [
|
||||
'karma-chrome-launcher',
|
||||
'karma-phantomjs-launcher',
|
||||
'karma-jasmine',
|
||||
'karma-ng-html2js-preprocessor',
|
||||
'karma-coverage',
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
ENVNAME=$1
|
||||
BASEPYTHON=$2
|
||||
COMMAND=$3
|
||||
|
||||
if [ ${COMMAND} = "pre" ]; then
|
||||
# crean-up
|
||||
rm -fr .tox/${ENVNAME}-log/
|
||||
# install horizon from git
|
||||
rm -fr .tox/${ENVNAME}/src/
|
||||
git clone https://git.openstack.org/openstack/horizon.git .tox/${ENVNAME}/src/horizon
|
||||
pip install -U -t .tox/${ENVNAME}/lib/${BASEPYTHON}/site-packages/ .tox/${ENVNAME}/src/horizon
|
||||
elif [ ${COMMAND} = "post" ]; then
|
||||
# crean-up
|
||||
rm -fr .tox/${ENVNAME}/src/
|
||||
mv .tox/${ENVNAME}/log/ .tox/${ENVNAME}-log/
|
||||
rm -fr .tox/${ENVNAME}/
|
||||
fi
|
||||
|
109
tox.ini
109
tox.ini
|
@ -1,43 +1,101 @@
|
|||
[tox]
|
||||
envlist = pep8,py27,py35,py35dj20,releasenotes
|
||||
envlist = pep8,py35,py35dj20,py27,eslint,karma,docs,releasenotes
|
||||
minversion = 2.3.2
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
DJANGO_SETTINGS_MODULE=senlin_dashboard.test.settings
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = {envpython} {toxinidir}/manage.py test {posargs}
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8
|
||||
deps =
|
||||
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = python manage.py test {posargs} --settings=senlin_dashboard.test.settings
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:py35dj20]
|
||||
basepython = python3.5
|
||||
whitelist_externals = git
|
||||
commands =
|
||||
# NOTE(shu-mutow): To test this new env, need to re-install recent horizon
|
||||
# from git master branch like CI infra does.
|
||||
git clone https://git.openstack.org/openstack/horizon.git .tox/py35dj20/src/horizon
|
||||
pip install -U -t .tox/py35dj20/lib/python3.5/site-packages/ .tox/py35dj20/src/horizon
|
||||
pip install django>=2.0,<2.1
|
||||
{envpython} {toxinidir}/manage.py test {posargs}
|
||||
[testenv:pep8]
|
||||
commands = flake8
|
||||
|
||||
[flake8]
|
||||
show-source = True
|
||||
enable-extensions = H203,H106
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.ropeproject,tools,node_modules
|
||||
|
||||
[testenv:cover]
|
||||
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||
|
||||
[testenv:py27]
|
||||
commands =
|
||||
# Clean-up env and install horizon from git
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
|
||||
# Run test
|
||||
python manage.py test {posargs}
|
||||
# Clean-up env except log
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
|
||||
|
||||
[testenv:py35]
|
||||
basepython = python3.5
|
||||
commands =
|
||||
# Clean-up env and install horizon from git
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
|
||||
# Run test
|
||||
python manage.py test {posargs}
|
||||
# Clean-up env except log
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
|
||||
|
||||
[testenv:py35dj20]
|
||||
basepython = python3.5
|
||||
commands =
|
||||
# Clean-up env and install horizon from git
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
|
||||
# Run test
|
||||
pip install django>=2.0,<2.1
|
||||
python manage.py test {posargs}
|
||||
# Clean-up env except log
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
|
||||
|
||||
[testenv:eslint]
|
||||
whitelist_externals =
|
||||
npm
|
||||
commands =
|
||||
# Clean-up env and install horizon from git
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
|
||||
# Run test
|
||||
npm install
|
||||
npm run lint
|
||||
# Clean-up env except log
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
|
||||
|
||||
[testenv:karma]
|
||||
whitelist_externals =
|
||||
npm
|
||||
commands =
|
||||
# Clean-up env and install horizon from git
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
|
||||
# Run test
|
||||
npm install
|
||||
npm run test
|
||||
# Clean-up env except log
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
|
||||
|
||||
[testenv:docs]
|
||||
commands = python setup.py build_sphinx
|
||||
commands =
|
||||
# Clean-up env and install horizon from git
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
|
||||
# Run test
|
||||
python setup.py build_sphinx
|
||||
# Clean-up env except log
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
|
||||
|
||||
[testenv:releasenotes]
|
||||
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
commands =
|
||||
# Clean-up env and install horizon from git
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
|
||||
# Run test
|
||||
sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
# Clean-up env except log
|
||||
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
|
||||
|
||||
[testenv:debug]
|
||||
whitelist_externals = oslo_debug_helper
|
||||
|
@ -48,11 +106,6 @@ commands =
|
|||
pybabel extract -F babel-django.cfg -o senlin_dashboard/locale/django.pot -k gettext_noop -k gettext_lazy -k ngettext_lazy:1,2 -k ugettext_noop -k ugettext_lazy -k ungettext_lazy:1,2 -k npgettext:1c,2,3 -k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3 senlin_dashboard
|
||||
pybabel extract -F babel-djangojs.cfg -o senlin_dashboard/locale/djangojs.pot -k gettext_noop -k gettext_lazy -k ngettext_lazy:1,2 -k ugettext_noop -k ugettext_lazy -k ungettext_lazy:1,2 -k npgettext:1c,2,3 -k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3 senlin_dashboard
|
||||
|
||||
[flake8]
|
||||
show-source = True
|
||||
enable-extensions = H203,H106
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.ropeproject,tools,node_modules
|
||||
|
||||
[testenv:lower-constraints]
|
||||
basepython = python3
|
||||
deps =
|
||||
|
|
Loading…
Reference in New Issue