From dbd861712228c0e5cb8b959c0b75b76cca66c156 Mon Sep 17 00:00:00 2001 From: Kiall Mac Innes Date: Sun, 9 Jun 2013 15:06:11 +0100 Subject: [PATCH] Add Hacking checks Change-Id: I5435e83a8dbe3c3273b59ecb3c5f1be26c9bec96 --- monikerclient/cli/domains.py | 2 +- monikerclient/cli/records.py | 2 +- monikerclient/cli/servers.py | 2 +- monikerclient/exceptions.py | 4 +++- test-requirements.txt | 12 +++++++++++- tox.ini | 15 ++++++++++----- 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/monikerclient/cli/domains.py b/monikerclient/cli/domains.py index 2a5e7dce..9e0884e0 100644 --- a/monikerclient/cli/domains.py +++ b/monikerclient/cli/domains.py @@ -81,7 +81,7 @@ class UpdateDomainCommand(base.UpdateCommand): return parser def execute(self, parsed_args): - # TODO: API needs updating.. this get is silly + # TODO(kiall): API needs updating.. this get is silly domain = self.client.domains.get(parsed_args.id) if parsed_args.name: diff --git a/monikerclient/cli/records.py b/monikerclient/cli/records.py index fef46b6e..7f2f50c3 100644 --- a/monikerclient/cli/records.py +++ b/monikerclient/cli/records.py @@ -107,7 +107,7 @@ class UpdateRecordCommand(base.UpdateCommand): return parser def execute(self, parsed_args): - # TODO: API needs updating.. this get is silly + # TODO(kiall): API needs updating.. this get is silly record = self.client.records.get(parsed_args.domain_id, parsed_args.id) if parsed_args.name: diff --git a/monikerclient/cli/servers.py b/monikerclient/cli/servers.py index 8a6d623b..c393cdb3 100644 --- a/monikerclient/cli/servers.py +++ b/monikerclient/cli/servers.py @@ -73,7 +73,7 @@ class UpdateServerCommand(base.UpdateCommand): return parser def execute(self, parsed_args): - # TODO: API needs updating.. this get is silly + # TODO(kiall): API needs updating.. this get is silly server = self.client.servers.get(parsed_args.id) if parsed_args.name: diff --git a/monikerclient/exceptions.py b/monikerclient/exceptions.py index 6d276cc8..871090c5 100644 --- a/monikerclient/exceptions.py +++ b/monikerclient/exceptions.py @@ -24,13 +24,15 @@ class ResourceNotFound(Base): class RemoteError(Base): - def __init__(self, message=None, code=None, type=None, errors=None): + def __init__(self, message=None, code=None, type=None, errors=None, + request_id=None): super(RemoteError, self).__init__(message) self.message = message self.code = code self.type = type self.errors = errors + self.request_id = request_id class Unknown(RemoteError): diff --git a/test-requirements.txt b/test-requirements.txt index ed753e88..d5926adf 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,14 @@ -flake8 +# Packages needed for dev testing +distribute>=0.6.24 + +# Install bounded pep8/pyflakes first, then let flake8 install +pep8==1.4.5 +pyflakes==0.7.2 +flake8==2.0 +hacking>=0.5.3,<0.6 + +coverage>=3.6 + mox python-subunit sphinx diff --git a/tox.ini b/tox.ini index 010130b0..629cb5a4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,9 @@ [tox] -envlist = py26,py27,pep8 +envlist = py26,py27,flake8 minversion = 1.4.0 [testenv] +sitepackages = False setenv = VIRTUAL_ENV={envdir} LANG=en_US.UTF-8 LANGUAGE=en_US:en @@ -11,15 +12,19 @@ deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = python setup.py testr --testr-args='{posargs}' -sitepackages = False - [tox:jenkins] downloadcache = ~/cache/pip +[testenv:flake8] +commands = flake8 + [testenv:pep8] commands = flake8 +[testenv:pyflakes] +commands = flake8 + [testenv:cover] commands = python setup.py testr --coverage --testr-args='{posargs}' @@ -27,6 +32,6 @@ commands = python setup.py testr --coverage --testr-args='{posargs}' commands = {posargs} [flake8] -ignore = E12,E711,E721,E712,F,H302 -show-source = True +ignore = H302,H306,H401,H402,H404 +builtins = _ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools