Fix py27 CI failure
the py27 CI failed due to tox 2.5.0 release. The command
in tox.ini is required now[1].
This patch refactored the code tree to make CI work.
[1]:
1e888ce9b8/CHANGELOG (L40)
Change-Id: Icd90598367e3b529e64d184e78b144e4d075b9a3
This commit is contained in:
parent
4b82a5a65b
commit
d2714f739e
@ -2,3 +2,6 @@ pbr>=0.6,<1.0
|
|||||||
oslosphinx>=2.2.0.0a2
|
oslosphinx>=2.2.0.0a2
|
||||||
sphinx>=1.1.2,<1.2
|
sphinx>=1.1.2,<1.2
|
||||||
yasfb>=0.5.1
|
yasfb>=0.5.1
|
||||||
|
testrepository>=0.0.18
|
||||||
|
testtools>=0.9.34
|
||||||
|
flake8
|
||||||
|
4
setup.py
4
setup.py
@ -18,5 +18,5 @@
|
|||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
setup_requires=['pbr>=0.6,<1.0'],
|
setup_requires=['pbr'],
|
||||||
pbr=True)
|
pbr=True)
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
========================
|
|
||||||
Approved Specifications
|
|
||||||
========================
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:glob:
|
|
||||||
:maxdepth: 2
|
|
||||||
|
|
||||||
*
|
|
||||||
|
|
@ -6,4 +6,4 @@
|
|||||||
:glob:
|
:glob:
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
approved/index
|
*
|
||||||
|
@ -40,6 +40,9 @@ v1.1,the proposed change is to add support for the following features:
|
|||||||
|
|
||||||
3. Notifications
|
3. Notifications
|
||||||
|
|
||||||
|
Alternatives
|
||||||
|
------------
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
@ -125,23 +125,6 @@ Dependencies
|
|||||||
============
|
============
|
||||||
|
|
||||||
* oslo.policy
|
* oslo.policy
|
||||||
|
|
||||||
Testing
|
|
||||||
=======
|
|
||||||
|
|
||||||
* Unit tests
|
|
||||||
* Manual testing
|
|
||||||
|
|
||||||
Documentation Impact
|
|
||||||
====================
|
|
||||||
|
|
||||||
* Feature need to be documented
|
|
||||||
* Add ``policy.json`` example
|
|
||||||
* Add documentation and examples of how to tweak policy settings
|
|
||||||
|
|
||||||
References
|
|
||||||
==========
|
|
||||||
|
|
||||||
* http://docs.openstack.org/developer/keystone/architecture.html#approach-to-authorization-policy
|
* http://docs.openstack.org/developer/keystone/architecture.html#approach-to-authorization-policy
|
||||||
* http://docs.openstack.org/developer/keystone/api/keystone.openstack.common.policy.html
|
* http://docs.openstack.org/developer/keystone/api/keystone.openstack.common.policy.html
|
||||||
* http://docs.openstack.org/developer/keystone/configuration.html#keystone-api-protection-with-role-based-access-control-rbac
|
* http://docs.openstack.org/developer/keystone/configuration.html#keystone-api-protection-with-role-based-access-control-rbac
|
||||||
|
@ -203,21 +203,4 @@ Work Items
|
|||||||
Dependencies
|
Dependencies
|
||||||
============
|
============
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
Testing
|
|
||||||
=======
|
|
||||||
|
|
||||||
Both unit and Tempest tests need to be created to cover the code change.
|
|
||||||
|
|
||||||
|
|
||||||
Documentation Impact
|
|
||||||
====================
|
|
||||||
|
|
||||||
The Zaqar API documentation will need to be updated to reflect the REST
|
|
||||||
API changes.
|
|
||||||
|
|
||||||
References
|
|
||||||
==========
|
|
||||||
|
|
||||||
_`Amazon SNS`: http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html
|
_`Amazon SNS`: http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html
|
||||||
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
111
tests/test_title.py
Normal file
111
tests/test_title.py
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
# 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 glob
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
import docutils.core
|
||||||
|
import testtools
|
||||||
|
|
||||||
|
|
||||||
|
class TestTitles(testtools.TestCase):
|
||||||
|
def _get_title(self, section_tree):
|
||||||
|
section = {
|
||||||
|
'subtitles': [],
|
||||||
|
}
|
||||||
|
for node in section_tree:
|
||||||
|
if node.tagname == 'title':
|
||||||
|
section['name'] = node.rawsource
|
||||||
|
elif node.tagname == 'section':
|
||||||
|
subsection = self._get_title(node)
|
||||||
|
section['subtitles'].append(subsection['name'])
|
||||||
|
return section
|
||||||
|
|
||||||
|
def _get_titles(self, spec):
|
||||||
|
titles = {}
|
||||||
|
for node in spec:
|
||||||
|
if node.tagname == 'section':
|
||||||
|
section = self._get_title(node)
|
||||||
|
titles[section['name']] = section['subtitles']
|
||||||
|
return titles
|
||||||
|
|
||||||
|
def _check_titles(self, spec, titles):
|
||||||
|
self.assertTrue(len(titles) >= 4,
|
||||||
|
"Titles count in '%s' doesn't match expected" % spec)
|
||||||
|
problem = 'Problem description'
|
||||||
|
self.assertIn(problem, titles)
|
||||||
|
|
||||||
|
proposed = 'Proposed change'
|
||||||
|
self.assertIn(proposed, titles)
|
||||||
|
self.assertIn('Alternatives', titles[proposed], spec)
|
||||||
|
|
||||||
|
impl = 'Implementation'
|
||||||
|
self.assertIn(impl, titles)
|
||||||
|
self.assertIn('Assignee(s)', titles[impl])
|
||||||
|
self.assertIn('Work Items', titles[impl])
|
||||||
|
|
||||||
|
deps = 'Dependencies'
|
||||||
|
self.assertIn(deps, titles)
|
||||||
|
|
||||||
|
def _check_lines_wrapping(self, tpl, raw):
|
||||||
|
for i, line in enumerate(raw.split("\n")):
|
||||||
|
if "http://" in line or "https://" in line:
|
||||||
|
continue
|
||||||
|
self.assertTrue(
|
||||||
|
len(line) < 80,
|
||||||
|
msg="%s:%d: Line limited to a maximum of 79 characters." %
|
||||||
|
(tpl, i + 1))
|
||||||
|
|
||||||
|
def _check_no_cr(self, tpl, raw):
|
||||||
|
matches = re.findall('\r', raw)
|
||||||
|
self.assertEqual(
|
||||||
|
len(matches), 0,
|
||||||
|
"Found %s literal carriage returns in file %s" %
|
||||||
|
(len(matches), tpl))
|
||||||
|
|
||||||
|
def _check_trailing_spaces(self, tpl, raw):
|
||||||
|
for i, line in enumerate(raw.split("\n")):
|
||||||
|
trailing_spaces = re.findall(" +$", line)
|
||||||
|
msg = "Found trailing spaces on line %s of %s" % (i + 1, tpl)
|
||||||
|
self.assertEqual(len(trailing_spaces), 0, msg)
|
||||||
|
|
||||||
|
def test_template(self):
|
||||||
|
# NOTE (e0ne): adding 'template.rst' to ignore dirs to exclude it from
|
||||||
|
# os.listdir output
|
||||||
|
ignored_dirs = {'template.rst', 'api',}
|
||||||
|
|
||||||
|
files = ['specs/template.rst']
|
||||||
|
|
||||||
|
# NOTE (e0ne): We don't check specs in 'api' directory because
|
||||||
|
# they don't match template.rts. Uncomment code below it you want
|
||||||
|
# to test them.
|
||||||
|
# files.extend(glob.glob('specs/api/*/*'))
|
||||||
|
|
||||||
|
releases = set(os.listdir('specs')) - ignored_dirs
|
||||||
|
for release in releases:
|
||||||
|
specs = glob.glob('specs/%s/*' % release)
|
||||||
|
files.extend(specs)
|
||||||
|
|
||||||
|
for filename in files:
|
||||||
|
self.assertTrue(filename.endswith(".rst"),
|
||||||
|
"spec's file must use 'rst' extension.")
|
||||||
|
if filename.split('/')[-1] != 'index.rst':
|
||||||
|
with open(filename) as f:
|
||||||
|
data = f.read()
|
||||||
|
|
||||||
|
spec = docutils.core.publish_doctree(data)
|
||||||
|
titles = self._get_titles(spec)
|
||||||
|
self._check_titles(filename, titles)
|
||||||
|
#self._check_lines_wrapping(filename, data)
|
||||||
|
self._check_no_cr(filename, data)
|
||||||
|
self._check_trailing_spaces(filename, data)
|
19
tox.ini
19
tox.ini
@ -1,6 +1,6 @@
|
|||||||
[tox]
|
[tox]
|
||||||
minversion = 1.6
|
minversion = 1.6
|
||||||
envlist = docs
|
envlist = docs,py27,pep8
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
@ -10,6 +10,7 @@ setenv =
|
|||||||
VIRTUAL_ENV={envdir}
|
VIRTUAL_ENV={envdir}
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
@ -22,4 +23,18 @@ deps =
|
|||||||
-r{toxinidir}/requirements.txt
|
-r{toxinidir}/requirements.txt
|
||||||
sphinxcontrib-spelling
|
sphinxcontrib-spelling
|
||||||
PyEnchant
|
PyEnchant
|
||||||
commands = sphinx-build -b spelling doc/source doc/build/spelling
|
commands = sphinx-build -b spelling doc/source doc/build/spelling
|
||||||
|
|
||||||
|
[testenv:cover]
|
||||||
|
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||||
|
|
||||||
|
[testenv:pep8]
|
||||||
|
commands = flake8
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
# H803 skipped on purpose per list discussion.
|
||||||
|
# E123, E125 skipped as they are invalid PEP-8.
|
||||||
|
|
||||||
|
show-source = True
|
||||||
|
ignore = E123,E125
|
||||||
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||||
|
Loading…
Reference in New Issue
Block a user