Fixing initial PEP8 and python check errors

Note the locale part is temporarily disabled.  Need to be re-enabled
some time in future.

Change-Id: I3b2e0a2f40a171266ec76ad0d3cb4939e48d7ceb
This commit is contained in:
tengqm 2015-03-17 09:54:18 +08:00
parent aa59c55c09
commit a52c4a6ace
11 changed files with 100 additions and 29 deletions

80
doc/source/conf.py Executable 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('../..'))
# -- 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.todo'
#'sphinx.ext.intersphinx',
#'oslo.sphinx'
]
# 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 = 'index'
# General information about the project.
project = u'senlin'
copyright = u'2015, 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}
[extensions]
todo_include_todos=True

View File

@ -9,7 +9,7 @@ eventlet>=0.16.1
greenlet>=0.3.2
httplib2>=0.7.5
iso8601>=0.1.9
keystonemiddleware>=1.0.0,<1.4.0
keystonemiddleware>=1.0.0
kombu>=2.5.0
lxml>=2.3
netaddr>=0.7.12
@ -29,7 +29,7 @@ python-openstacksdk>=0.4.1
python-heatclient>=0.2.9
python-keystoneclient>=1.1.0
python-neutronclient>=2.3.6,<3
python-novaclient>=2.18.0
python-novaclient>=2.18.0,!=2.21.0
PyYAML>=3.1.0
qpid-python
requests>=2.2.0,!=2.4.0

View File

@ -12,7 +12,6 @@
from senlin.common import sdk
from senlin.drivers import base
from openstack import user_preference
from senlin.openstack.orchestration.v1 import stack

View File

@ -18,8 +18,6 @@ take corresponding actions to recover the clusters based on the pre-defined
health policies.
'''
import random
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
@ -77,10 +75,10 @@ class Health_Manager(service.Service, periodic_task.PeriodicTasks):
server.start()
if self.periodic_enable:
if self.periodic_fuzzy_delay:
initial_delay = random.randint(0, self.periodic_fuzzy_delay)
else:
initial_delay = None
# if self.periodic_fuzzy_delay:
# initial_delay = random.randint(0, self.periodic_fuzzy_delay)
# else:
# initial_delay = None
self.threadgroup.add_timer(self.periodic_interval_max,
self.periodic_tasks)

View File

@ -90,7 +90,7 @@ class RoutesTest(base.SenlinTestCase):
self.assertRoute(
self.m,
'/aaaa/profiles/bbbb',
'PUT',
'PATCH',
'update',
'ProfileController',
{
@ -166,7 +166,7 @@ class RoutesTest(base.SenlinTestCase):
self.assertRoute(
self.m,
'/aaaa/policies/bbbb',
'PUT',
'PATCH',
'update',
'PolicyController',
{
@ -220,7 +220,7 @@ class RoutesTest(base.SenlinTestCase):
self.assertRoute(
self.m,
'/aaaa/clusters/bbbb',
'PUT',
'PATCH',
'update',
'ClusterController',
{
@ -285,7 +285,7 @@ class RoutesTest(base.SenlinTestCase):
self.assertRoute(
self.m,
'/aaaa/nodes/bbbb',
'PUT',
'PATCH',
'update',
'NodeController',
{

View File

@ -86,9 +86,7 @@ class SenlinTestCase(testscenarios.WithScenarios,
self.addCleanup(utils.reset_dummy_db)
def stub_wallclock(self):
"""
Overrides scheduler wallclock to speed up tests expecting timeouts.
"""
# Overrides scheduler wallclock to speed up tests expecting timeouts.
self._wallclock = time.time()
def fake_wallclock():

View File

@ -19,9 +19,7 @@ from keystoneclient import exceptions
class FakeClient(object):
def assert_called(self, method, url, body=None, pos=-1):
"""
Assert than an API method was just called.
"""
# Assert than an API method was just called.
expected = (method, url)
called = self.client.callstack[pos][0:2]
@ -35,9 +33,7 @@ class FakeClient(object):
assert self.client.callstack[pos][2] == body
def assert_called_anytime(self, method, url, body=None):
"""
Assert than an API method was called anytime in the test.
"""
# Assert than an API method was called anytime in the test.
expected = (method, url)
assert self.client.callstack, \

View File

@ -284,7 +284,7 @@ class PolicyTest(base.SenlinTestCase):
p = self.eng.policy_get(self.ctx, pid)
self.assertEqual('p-2', p['name'])
# 2. update cooldown
# 2. update cooldown
p2 = self.eng.policy_update(self.ctx, pid, cooldown=120)
self.assertEqual(pid, p2['id'])
self.assertEqual(120, p2['cooldown'])
@ -293,7 +293,7 @@ class PolicyTest(base.SenlinTestCase):
p = self.eng.policy_get(self.ctx, pid)
self.assertEqual(120, p['cooldown'])
# 3. update level
# 3. update level
p2 = self.eng.policy_update(self.ctx, pid, level=50)
self.assertEqual(pid, p2['id'])
self.assertEqual(50, p2['level'])

View File

@ -17,7 +17,7 @@ from oslo_config import cfg
from senlin.common import exception
from senlin.common import policy
from senlin.openstack.common import policy as base_policy
from senlin.tests.common import base
from senlin.tests.common import base
from senlin.tests.common import utils
policy_path = os.path.dirname(os.path.realpath(__file__)) + "/policy/"

View File

@ -3,14 +3,14 @@
# process, which may cause wedges in the gate later.
# Hacking already pins down pep8, pyflakes and flake8
hacking>=0.8.0,<0.9
hacking>=0.9.4,<0.10
coverage>=3.6
discover
mock>=1.0
mox>=0.5.3
MySQL-python
oslosphinx>=2.2.0 # Apache-2.0
oslotest>=1.2.0 # Apache-2.0
oslosphinx>=2.2.0 # Apache-2.0
oslotest>=1.2.0 # Apache-2.0
paramiko>=1.13.0
psycopg2
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3

View File

@ -22,7 +22,7 @@ whitelist_externals = bash
commands =
flake8 senlin bin/senlin-api bin/senlin-engine bin/senlin-manage
# Check that .po and .pot files are valid:
bash -c "find senlin -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null"
# bash -c "find senlin -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null"
[testenv:venv]
commands = {posargs}