From 4dee0a89adf25da6bf8b806408fafd4ace936a7c Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Mon, 16 Feb 2015 21:48:26 +0300 Subject: [PATCH] Apply bootstrap styles to the report template Also add simple test to fix failing gate jobs Change-Id: I92b03072d06ea3220a5ba872c7541b8b7bd1401f --- .gitreview | 4 ++++ setup.cfg | 6 ++++++ shaker/engine/report.template | 21 ++++++++++++++++++--- shaker/engine/utils.py | 7 ++++--- test-requirements.txt | 2 ++ tests/test_utils.py | 30 ++++++++++++++++++++++++++++++ tox.ini | 5 ++++- 7 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 .gitreview create mode 100644 tests/test_utils.py diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..bac5f36 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=stackforge/shaker.git diff --git a/setup.cfg b/setup.cfg index 476ac8d..969a964 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,3 +30,9 @@ console_scripts = oslo.config.opts = shaker.openstack.common.log = shaker.openstack.common.log:list_opts shaker.engine.config = shaker.engine.config:list_opts + +[build_sphinx] +all_files = 1 +build-dir = doc/build +source-dir = doc/source + diff --git a/shaker/engine/report.template b/shaker/engine/report.template index 88b4aa0..23f10b4 100644 --- a/shaker/engine/report.template +++ b/shaker/engine/report.template @@ -1,10 +1,24 @@ - - - + + + + + Shaker report + + + + + + + + + +

Report

@@ -57,5 +71,6 @@ {% endfor %} +
diff --git a/shaker/engine/utils.py b/shaker/engine/utils.py index 365d6c5..b03fc9c 100644 --- a/shaker/engine/utils.py +++ b/shaker/engine/utils.py @@ -41,9 +41,10 @@ def read_file(file_name): def split_address(address): - host, port = address.split(':') - if not port: - raise Exception('Invalid address: %s', address) + try: + host, port = address.split(':') + except ValueError: + raise ValueError('Invalid address: %s, "host:port" expected', address) return host, port diff --git a/test-requirements.txt b/test-requirements.txt index c412981..579e2ec 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,5 +6,7 @@ hacking>=0.8.0,<0.9 mock>=1.0 python-subunit>=0.0.18 +sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 +sphinxcontrib-httpdomain testrepository>=0.0.18 testtools>=0.9.36,!=1.2.0 diff --git a/tests/test_utils.py b/tests/test_utils.py new file mode 100644 index 0000000..ba4d3aa --- /dev/null +++ b/tests/test_utils.py @@ -0,0 +1,30 @@ +# Copyright (c) 2015 Mirantis Inc. +# +# 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 testtools + +from shaker.engine import utils + + +class TestUtils(testtools.TestCase): + def setUp(self): + super(TestUtils, self).setUp() + + def test_split_address_valid(self): + self.assertEqual(('10.0.0.1', '6777'), + utils.split_address('10.0.0.1:6777')) + + def test_split_address_invalid(self): + self.assertRaises(ValueError, utils.split_address, 'erroneous') diff --git a/tox.ini b/tox.ini index 9a2a545..1bd7fdc 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py34,py27,pep8,bashate +envlist = py34,py27,pep8,bashate,docs minversion = 1.6 skipsdist = True @@ -37,6 +37,9 @@ commands = [tox:jenkins] downloadcache = ~/cache/pip +[testenv:docs] +commands = python setup.py build_sphinx + [flake8] # E125 continuation line does not distinguish itself from next logical line ignore = E125