Migrate to flake8.
Fixes bug 1172444. Change-Id: Ia063ec67de9e6061ce38b948c9eb60b5589c7bb4
This commit is contained in:
22
run_tests.sh
22
run_tests.sh
@@ -117,26 +117,8 @@ function copy_subunit_log {
|
||||
}
|
||||
|
||||
function run_pep8 {
|
||||
echo "Running pep8 ..."
|
||||
srcfiles="cinderclient tests"
|
||||
# Just run PEP8 in current environment
|
||||
#
|
||||
# NOTE(sirp): W602 (deprecated 3-arg raise) is being ignored for the
|
||||
# following reasons:
|
||||
#
|
||||
# 1. It's needed to preserve traceback information when re-raising
|
||||
# exceptions; this is needed b/c Eventlet will clear exceptions when
|
||||
# switching contexts.
|
||||
#
|
||||
# 2. There doesn't appear to be an alternative, "pep8-tool" compatible way of doing this
|
||||
# in Python 2 (in Python 3 `with_traceback` could be used).
|
||||
#
|
||||
# 3. Can find no corroborating evidence that this is deprecated in Python 2
|
||||
# other than what the PEP8 tool claims. It is deprecated in Python 3, so,
|
||||
# perhaps the mistake was thinking that the deprecation applied to Python 2
|
||||
# as well.
|
||||
pep8_opts="--ignore=E202,W602 --repeat"
|
||||
${wrapper} pep8 ${pep8_opts} ${srcfiles}
|
||||
echo "Running flake8 ..."
|
||||
${wrapper} flake8
|
||||
}
|
||||
|
||||
TESTRTESTS="testr run --parallel $testropts"
|
||||
|
@@ -302,10 +302,10 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
return (200, {}, {
|
||||
'volume_types': [{'id': 1,
|
||||
'name': 'test-type-1',
|
||||
'extra_specs':{}},
|
||||
'extra_specs': {}},
|
||||
{'id': 2,
|
||||
'name': 'test-type-2',
|
||||
'extra_specs':{}}]})
|
||||
'extra_specs': {}}]})
|
||||
|
||||
def get_types_1(self, **kw):
|
||||
return (200, {}, {'volume_type': {'id': 1,
|
||||
|
@@ -192,7 +192,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
||||
}
|
||||
correct_response = json.dumps(dict_correct_response)
|
||||
dict_responses = [
|
||||
{"headers": {'location':'http://127.0.0.1:5001'},
|
||||
{"headers": {'location': 'http://127.0.0.1:5001'},
|
||||
"status_code": 305,
|
||||
"text": "Use proxy"},
|
||||
# Configured on admin port, cinder redirects to v2.0 port.
|
||||
|
@@ -309,10 +309,10 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
return (200, {}, {
|
||||
'volume_types': [{'id': 1,
|
||||
'name': 'test-type-1',
|
||||
'extra_specs':{}},
|
||||
'extra_specs': {}},
|
||||
{'id': 2,
|
||||
'name': 'test-type-2',
|
||||
'extra_specs':{}}]})
|
||||
'extra_specs': {}}]})
|
||||
|
||||
def get_types_1(self, **kw):
|
||||
return (200, {}, {'volume_type': {'id': 1,
|
||||
|
@@ -208,7 +208,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
||||
}
|
||||
correct_response = json.dumps(dict_correct_response)
|
||||
dict_responses = [
|
||||
{"headers": {'location':'http://127.0.0.1:5001'},
|
||||
{"headers": {'location': 'http://127.0.0.1:5001'},
|
||||
"status_code": 305,
|
||||
"text": "Use proxy"},
|
||||
# Configured on admin port, cinder redirects to v2.0 port.
|
||||
|
@@ -1,10 +1,15 @@
|
||||
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
|
||||
discover
|
||||
fixtures
|
||||
mock
|
||||
pep8==1.3.3
|
||||
sphinx>=1.1.2
|
||||
testrepository>=0.0.13
|
||||
testtools>=0.9.22
|
||||
|
8
tox.ini
8
tox.ini
@@ -12,8 +12,7 @@ deps = -r{toxinidir}/tools/pip-requires
|
||||
commands = python setup.py testr --testr-args='{posargs}'
|
||||
|
||||
[testenv:pep8]
|
||||
deps = pep8
|
||||
commands = pep8 --repeat --show-source cinderclient setup.py
|
||||
commands = flake8
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
@@ -23,3 +22,8 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||
|
||||
[tox:jenkins]
|
||||
downloadcache = ~/cache/pip
|
||||
|
||||
[flake8]
|
||||
show-source = True
|
||||
ignore = F,H
|
||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
|
||||
|
Reference in New Issue
Block a user