Skip to content

Commit

Permalink
Migrate to flake8.
Browse files Browse the repository at this point in the history
Fixes bug 1172444.

Change-Id: Ia063ec67de9e6061ce38b948c9eb60b5589c7bb4
  • Loading branch information
emonty committed May 18, 2013
1 parent 8044dc7 commit 24b4039
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 29 deletions.
22 changes: 2 additions & 20 deletions run_tests.sh
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions tests/v1/fakes.py
Expand Up @@ -302,10 +302,10 @@ def get_types(self, **kw):
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,
Expand Down
2 changes: 1 addition & 1 deletion tests/v1/test_auth.py
Expand Up @@ -192,7 +192,7 @@ def test_auth_redirect(self):
}
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.
Expand Down
4 changes: 2 additions & 2 deletions tests/v2/fakes.py
Expand Up @@ -309,10 +309,10 @@ def get_types(self, **kw):
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,
Expand Down
2 changes: 1 addition & 1 deletion tests/v2/test_auth.py
Expand Up @@ -208,7 +208,7 @@ def test_auth_redirect(self):
}
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.
Expand Down
7 changes: 6 additions & 1 deletion tools/test-requires
@@ -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 changes: 6 additions & 2 deletions tox.ini
Expand Up @@ -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}
Expand All @@ -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

0 comments on commit 24b4039

Please sign in to comment.