Updated tox.ini added .gitreview file

This patch allows the project to use tox correctly
Added git confirguration file
Added doc/source directory

Change-Id: Ibdb7e37afdc3e92de695918aff0beef8f7e13f4f
This commit is contained in:
Luis Daniel Castellanos 2016-09-30 15:54:02 -05:00
parent b7addaa10b
commit 8babaca289
13 changed files with 176 additions and 78 deletions

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/craton-dashboard.git

View File

@ -1,31 +0,0 @@
# Copyright 2016 Intel Corporation
#
# 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 craton_dashboard import api
from craton_dashboard.test import helpers as test
class CratonApiTests(test.CratonAPITestCase):
"""Tests for Craton APIs."""
def test_regions_list(self):
"""Test for getting all regions."""
regions = self.craton_regions.list()
cratonclient = self.stub_cratonclient()
cratonclient.regions = self.mox.CreateMockAnything()
cratonclient.regions.list().AndReturn(regions)
self.mox.ReplayAll()
result = api.craton.region_list(self.request)
self.assertEqual(len(regions), len(result))

View File

@ -13,13 +13,13 @@
# limitations under the License.
from cratonclient import session as craton_session
from cratonclient.v1 import client as craton_client
from cratonclient import session as craton_session # noqa
from cratonclient.v1 import client as craton_client # noqa
from horizon.utils.memoized import memoized # noqa
from horizon.utils.memoized import memoized_with_request # noqa
from openstack_dashboard.api import base
from openstack_dashboard.api import base # noqa
def get_auth_params_from_request(request):

View File

@ -22,8 +22,10 @@ class CratonApiTests(test.CratonAPITestCase):
regions = self.craton_regions.list()
cratonclient = self.stub_cratonclient()
cratonclient.regions = self.mox.CreateMockAnything()
cratonclient.regions.list().AndReturn(regions)
cratonclient.regions.list(project_id=regions[0].project_id)\
.AndReturn(regions)
self.mox.ReplayAll()
result = api.craton.region_list(self.request)
result = api.craton.region_list(self.request,
project_id=regions[0].project_id)
self.assertEqual(len(regions), len(result))

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cratonclient import session
from cratonclient.v1 import regions
from openstack_dashboard.test.test_data import utils
@ -20,22 +21,24 @@ from openstack_dashboard.test.test_data import utils
def data(TEST):
URL = 'http://localhost/'
TEST.craton_regions = utils.TestDataContainer()
SESSION = session.Session(username="test",
token="testPassword",
project_id='1')
# Regions
region_1 = regions.Region(regions.RegionManager(None, URL), {
region_1 = regions.Region(regions.RegionManager(SESSION, URL), {
'id': 1,
'name': 'Region1',
'note': 'TestNote',
'project_id': 1
})
region_2 = regions.Region(regions.RegionManager(None, URL), {
region_2 = regions.Region(regions.RegionManager(SESSION, URL), {
'id': 2,
'name': 'Region2',
'note': 'TestNote',
'project_id': 1
})
region_3 = regions.Region(regions.RegionManager(None, URL), {
region_3 = regions.Region(regions.RegionManager(SESSION, URL), {
'id': 3,
'name': 'Region3',
'note': 'TestNote',

80
doc/source/conf.py Normal file
View File

@ -0,0 +1,80 @@
# -*- coding: utf-8 -*-
# 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
sys.path.insert(0, os.path.abspath('../..'))
on_read_the_docs = os.environ.get('READTHEDOCS') == 'True'
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
#'sphinx.ext.intersphinx',
]
if not on_read_the_docs:
extensions.append('oslosphinx')
# autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'readme'
# General information about the project.
project = u'craton-dashboard'
copyright = u'2016, OpenStack Foundation'
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
add_module_names = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
# html_theme_path = ["."]
# html_theme = '_theme'
# html_static_path = ['static']
# Output file base name for HTML help builder.
htmlhelp_basename = '%sdoc' % project
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index',
'%s.tex' % project,
u'%s Documentation' % project,
u'OpenStack Foundation', 'manual'),
]
# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'http://docs.python.org/': None}

1
doc/source/readme.rst Normal file
View File

@ -0,0 +1 @@
.. include:: ../../README.rst

View File

@ -10,8 +10,7 @@ django-compressor>=2.0 # MIT
django-openstack-auth>=2.3.0 # Apache-2.0
iso8601>=0.1.11 # MIT
python-keystoneclient!=1.8.0,!=2.1.0,>=1.7.0 # Apache-2.0
python-manilaclient>=1.10.0 # Apache-2.0
python-neutronclient>=4.2.0 # Apache-2.0
python-novaclient!=2.33.0,>=2.29.0 # Apache-2.0
python-saharaclient>=0.16.0 # Apache-2.0
pytz>=2013.6 # MIT
pytz>=2013.6 # MIT
-e git+http://git.openstack.org/openstack/python-cratonclient#egg=python-cratonclient

View File

@ -1,5 +1,5 @@
[metadata]
name = craton-ui
name = craton-dashboard
summary = The Craton UI for Horizon Dashboard
description-file =
README.rst

View File

@ -9,8 +9,13 @@ django-nose>=1.4.4 # BSD
reno>=1.8.0 # Apache2
mock>=2.0 # BSD
mox3>=0.7.0 # Apache-2.0
nodeenv>=0.9.4 # BSD License # BSD
netifaces>=0.10.4 # MIT
nose # LGPL
nose-exclude # LGPL
nosehtmloutput>=0.0.3 # Apache-2.0
nosexcover # BSD
openstack.nose-plugin>=0.7 # Apache-2.0
python-subunit>=0.0.18
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
oslosphinx>=2.5.0 # Apache-2.0

View File

@ -47,10 +47,6 @@ usual_install () {
fi
$install_cmd -U -e ${HORIZON_PIP_LOCATION}
if [ -z "$CRATON_CLIENT_PIP_LOCATION"]; then
CRATON_CLIENT_PIP_LOCATION="git+https://git.openstack.org/openstack/python-cratonclient@$BRANCH_NAME#egg=python-cratonclient"
fi
$install_cmd -U -e ${CRATON_CLIENT_PIP_LOCATION}
}
install_cmd="pip install"

99
tox.ini
View File

@ -1,60 +1,99 @@
[tox]
minversion = 2.0
envlist = py34-constraints,py27-constraints,pypy-constraints,pep8-constraints
envlist = py35,py34,py27,pep8,py27dj18
skipsdist = True
[testenv]
usedevelop = True
install_command =
constraints: {[testenv:common-constraints]install_command}
pip install -U {opts} {packages}
{toxinidir}/tools/pip_install.sh unconstrained {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
commands = python setup.py test --slowest --testr-args='{posargs}'
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = /bin/bash
commands =
# Try to detect whether a limited test suite is being specified and if so
# direct the testing to that suite's project; otherwise run the full suite
bash -c 'project=`echo {posargs} | cut -d. -f1`; \
if [ -z "$project" ]; then \
EXIT_STATUS=0; \
{envpython} {toxinidir}/manage.py test craton_dashboard --settings=craton_dashboard.test.settings {posargs} || EXIT_STATUS=$?; \
exit $EXIT_STATUS; \
else \
{envpython} {toxinidir}/manage.py test {posargs} --settings=$project.test.settings --exclude-dir=craton_dashboard/test/integration_tests; \
fi'
[testenv:common-constraints]
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
[testenv:py27]
basepython = python2.7
setenv =
{[testenv]setenv}
PYTHONUNBUFFERED=1
[testenv:py34]
basepython = python3.4
setenv =
{[testenv]setenv}
PYTHONUNBUFFERED=1
[testenv:py35]
basepython = python3.5
setenv =
{[testenv]setenv}
PYTHONUNBUFFERED=1
[testenv:pep8]
commands = flake8 {posargs}
[testenv:pep8-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = flake8 {posargs}
commands = flake8
[testenv:venv]
commands = {posargs}
[testenv:venv-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = {posargs
# Django-1.8 is LTS
[testenv:py27dj18]
basepython = python2.7
commands = pip install django>=1.8,<1.9
/bin/bash run_tests.sh -N --no-pep8 {posargs}
[testenv:py27dj19]
basepython = python2.7
commands = pip install django>=1.9,<1.10
/bin/bash run_tests.sh -N --no-pep8 {posargs}
[testenv:py27dj110]
basepython = python2.7
commands = pip install django --pre --upgrade
/bin/bash run_tests.sh -N --no-pep8 {posargs}
[testenv:npm]
commands =
nodeenv -p
npm install
npm run {posargs:test}
[testenv:releasenotes]
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:cover]
commands = python setup.py test --coverage --testr-args='{posargs}'
[testenv:cover-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = python setup.py test --coverage --testr-args='{posargs}'
commands = python setup.py testr --coverage --testr-args='{posargs}'
[testenv:docs]
commands = python setup.py build_sphinx
[testenv:docs-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = python setup.py build_sphinx
[testenv:debug]
commands = oslo_debug_helper {posargs}
[testenv:debug-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = oslo_debug_helper {posargs}
[flake8]
show-source = True
# E123, E125 skipped as they are invalid PEP-8.
# H405 multi line docstring summary not separated with an empty line
show-source = True
ignore = E123,E125,H405
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,.ropeproject,tools
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.ropeproject,tools,node_modules
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files.
deps = bindep
commands = bindep test