Browse Source

Upgrade to pep8 1.3.3

Also expand scope of what is covered by pep8 test

Change-Id: Ifc8924914b5a0d625bc8df6442ee85eb21459cde
Joe Gordon 6 years ago
parent
commit
96630b8248
5 changed files with 14 additions and 26 deletions
  1. 1
    1
      novaclient/shell.py
  2. 5
    5
      novaclient/v1_1/shell.py
  3. 3
    17
      run_tests.sh
  4. 1
    1
      tools/test-requires
  5. 4
    2
      tox.ini

+ 1
- 1
novaclient/shell.py View File

@@ -209,7 +209,7 @@ class OpenStackComputeShell(object):
209 209
         parser = NovaClientArgumentParser(
210 210
             prog='nova',
211 211
             description=__doc__.strip(),
212
-            epilog='See "nova help COMMAND" '\
212
+            epilog='See "nova help COMMAND" '
213 213
                    'for help on a specific command.',
214 214
             add_help=False,
215 215
             formatter_class=OpenStackHelpFormatter,

+ 5
- 5
novaclient/v1_1/shell.py View File

@@ -110,7 +110,7 @@ def _boot(cs, args, reservation_id=None, min_count=None, max_count=None):
110 110
         try:
111 111
             userdata = open(args.user_data)
112 112
         except IOError, e:
113
-            raise exceptions.CommandError("Can't open '%s': %s" % \
113
+            raise exceptions.CommandError("Can't open '%s': %s" %
114 114
                                           (args.user_data, e))
115 115
     else:
116 116
         userdata = None
@@ -200,14 +200,14 @@ def _boot(cs, args, reservation_id=None, min_count=None, max_count=None):
200 200
      metavar="<key=value>",
201 201
      action='append',
202 202
      default=[],
203
-     help="Record arbitrary key/value metadata to /meta.js "\
203
+     help="Record arbitrary key/value metadata to /meta.js "
204 204
           "on the new server. Can be specified multiple times.")
205 205
 @utils.arg('--file',
206 206
      metavar="<dst-path=src-path>",
207 207
      action='append',
208 208
      dest='files',
209 209
      default=[],
210
-     help="Store arbitrary files from <src-path> locally to <dst-path> "\
210
+     help="Store arbitrary files from <src-path> locally to <dst-path> "
211 211
           "on the new server. You may store up to 5 files.")
212 212
 @utils.arg('--key-name',
213 213
     metavar='<key-name>',
@@ -1961,7 +1961,7 @@ def do_secgroup_delete_group_rule(cs, args):
1961 1961
         if (rule.get('ip_protocol') == params.get('ip_protocol') and
1962 1962
             rule.get('from_port') == params.get('from_port') and
1963 1963
             rule.get('to_port') == params.get('to_port') and
1964
-            rule.get('group', {}).get('name') == \
1964
+            rule.get('group', {}).get('name') ==
1965 1965
                      params.get('group_name')):
1966 1966
             return cs.security_group_rules.delete(rule['id'])
1967 1967
 
@@ -1985,7 +1985,7 @@ def do_keypair_add(cs, args):
1985 1985
             with open(os.path.expanduser(pub_key)) as f:
1986 1986
                 pub_key = f.read()
1987 1987
         except IOError, e:
1988
-            raise exceptions.CommandError("Can't open or read '%s': %s" % \
1988
+            raise exceptions.CommandError("Can't open or read '%s': %s" %
1989 1989
                                                           (pub_key, e))
1990 1990
 
1991 1991
     keypair = cs.keypairs.create(name, pub_key)

+ 3
- 17
run_tests.sh View File

@@ -103,25 +103,11 @@ function copy_subunit_log {
103 103
 
104 104
 function run_pep8 {
105 105
   echo "Running pep8 ..."
106
-  srcfiles="novaclient tests"
106
+  srcfiles="--exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg ."
107 107
   # Just run PEP8 in current environment
108 108
   #
109
-  # NOTE(sirp): W602 (deprecated 3-arg raise) is being ignored for the
110
-  # following reasons:
111
-  #
112
-  #  1. It's needed to preserve traceback information when re-raising
113
-  #     exceptions; this is needed b/c Eventlet will clear exceptions when
114
-  #     switching contexts.
115
-  #
116
-  #  2. There doesn't appear to be an alternative, "pep8-tool" compatible way of doing this
117
-  #     in Python 2 (in Python 3 `with_traceback` could be used).
118
-  #
119
-  #  3. Can find no corroborating evidence that this is deprecated in Python 2
120
-  #     other than what the PEP8 tool claims. It is deprecated in Python 3, so,
121
-  #     perhaps the mistake was thinking that the deprecation applied to Python 2
122
-  #     as well.
123
-  pep8_opts="--ignore=E202,W602 --repeat"
124
-  ${wrapper} pep8 ${pep8_opts} ${srcfiles}
109
+  ignore="--ignore=E12,E711,E721,E712"
110
+  ${wrapper} pep8 ${ignore} --show-source ${srcfiles}
125 111
 }
126 112
 
127 113
 TESTRTESTS="testr run --parallel $testropts"

+ 1
- 1
tools/test-requires View File

@@ -4,7 +4,7 @@ coverage
4 4
 discover
5 5
 fixtures>=0.3.12
6 6
 mock
7
-pep8==1.1
7
+pep8==1.3.3
8 8
 sphinx>=1.1.2
9 9
 testrepository>=0.0.13
10 10
 testtools>=0.9.26

+ 4
- 2
tox.ini View File

@@ -12,8 +12,10 @@ deps = -r{toxinidir}/tools/pip-requires
12 12
 commands = python setup.py testr --testr-args='{posargs}'
13 13
 
14 14
 [testenv:pep8]
15
-deps = pep8==1.1
16
-commands = pep8 --repeat --show-source novaclient setup.py
15
+deps = pep8==1.3.3
16
+commands =
17
+  pep8 --ignore=E12,E711,E721,E712 --show-source \
18
+    --exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg .
17 19
 
18 20
 [testenv:venv]
19 21
 commands = {posargs}

Loading…
Cancel
Save