Fix pep8 issues

The pep8 jobs aren't running in gate at the moment.
Fix up the pep8 issues and remove the tox filter that stopped it
from running.

Also ignore E129 (visually indented line with same indent as next
logical line) as we don't follow it.

Change-Id: I394708ba96797bbc6fcd951e6436a104be0a3746
diff --git a/tests/base.py b/tests/base.py
index 6045bed..b872a85 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -262,14 +262,16 @@
                     granted_on=None):
         if not granted_on:
             granted_on = time.time()
-        approval = {'description': self.categories[category][0],
-                    'type': category,
-                    'value': str(value),
-                    'by': {
-                        'username': username,
-                        'email': username + '@example.com',
-                    },
-                    'grantedOn': int(granted_on)}
+        approval = {
+            'description': self.categories[category][0],
+            'type': category,
+            'value': str(value),
+            'by': {
+                'username': username,
+                'email': username + '@example.com',
+            },
+            'grantedOn': int(granted_on)
+        }
         for i, x in enumerate(self.patchsets[-1]['approvals'][:]):
             if x['by']['username'] == username and x['type'] == category:
                 del self.patchsets[-1]['approvals'][i]
@@ -359,7 +361,7 @@
 
     def setMerged(self):
         if (self.depends_on_change and
-            self.depends_on_change.data['status'] != 'MERGED'):
+                self.depends_on_change.data['status'] != 'MERGED'):
             return
         if self.fail_merge:
             return
@@ -420,7 +422,7 @@
         # project
         self.queries.append(query)
         l = [change.query() for change in self.changes.values()]
-        l.append({"type":"stats","rowCount":1,"runTimeMilliseconds":3})
+        l.append({"type": "stats", "rowCount": 1, "runTimeMilliseconds": 3})
         return l
 
     def startWatching(self, *args, **kw):
@@ -835,7 +837,8 @@
                 '%(levelname)-8s %(message)s'))
         if USE_TEMPDIR:
             tmp_root = self.useFixture(fixtures.TempDir(
-                    rootdir=os.environ.get("ZUUL_TEST_ROOT"))).path
+                rootdir=os.environ.get("ZUUL_TEST_ROOT"))
+            ).path
         else:
             tmp_root = os.environ.get("ZUUL_TEST_ROOT")
         self.test_root = os.path.join(tmp_root, "zuul-test")
@@ -934,7 +937,8 @@
         self.sched.registerTrigger(self.gerrit)
         self.timer = zuul.trigger.timer.Timer(self.config, self.sched)
         self.sched.registerTrigger(self.timer)
-        self.zuultrigger = zuul.trigger.zuultrigger.ZuulTrigger(self.config, self.sched)
+        self.zuultrigger = zuul.trigger.zuultrigger.ZuulTrigger(self.config,
+                                                                self.sched)
         self.sched.registerTrigger(self.zuultrigger)
 
         self.sched.registerReporter(
diff --git a/tests/test_cloner.py b/tests/test_cloner.py
index a639a52..137c157 100644
--- a/tests/test_cloner.py
+++ b/tests/test_cloner.py
@@ -25,7 +25,6 @@
 import zuul.lib.cloner
 
 from tests.base import ZuulTestCase
-from tests.base import FIXTURE_DIR
 
 logging.basicConfig(level=logging.DEBUG,
                     format='%(asctime)s %(name)-32s '
@@ -81,11 +80,10 @@
         B.setMerged()
 
         upstream = self.getUpstreamRepos(projects)
-        states = [
-            {'org/project1': self.builds[0].parameters['ZUUL_COMMIT'],
-             'org/project2': str(upstream['org/project2'].commit('master')),
-             },
-            ]
+        states = [{
+            'org/project1': self.builds[0].parameters['ZUUL_COMMIT'],
+            'org/project2': str(upstream['org/project2'].commit('master')),
+        }]
 
         for number, build in enumerate(self.builds):
             self.log.debug("Build parameters: %s", build.parameters)
@@ -97,7 +95,7 @@
                 zuul_ref=build.parameters['ZUUL_REF'],
                 zuul_url=self.git_root,
                 cache_dir=cache_root,
-                )
+            )
             cloner.execute()
             work = self.getWorkspaceRepos(projects)
             state = states[number]
@@ -110,9 +108,11 @@
 
         work = self.getWorkspaceRepos(projects)
         upstream_repo_path = os.path.join(self.upstream_root, 'org/project1')
-        self.assertEquals(work['org/project1'].remotes.origin.url,
-                          upstream_repo_path,
-                          'workspace repo origin should be upstream, not cache')
+        self.assertEquals(
+            work['org/project1'].remotes.origin.url,
+            upstream_repo_path,
+            'workspace repo origin should be upstream, not cache'
+        )
 
         self.worker.hold_jobs_in_build = False
         self.worker.release()
@@ -141,7 +141,7 @@
             {'org/project1': self.builds[0].parameters['ZUUL_COMMIT'],
              'org/project2': self.builds[1].parameters['ZUUL_COMMIT'],
              },
-            ]
+        ]
 
         for number, build in enumerate(self.builds):
             self.log.debug("Build parameters: %s", build.parameters)
@@ -152,7 +152,7 @@
                 zuul_branch=build.parameters['ZUUL_BRANCH'],
                 zuul_ref=build.parameters['ZUUL_REF'],
                 zuul_url=self.git_root,
-                )
+            )
             cloner.execute()
             work = self.getWorkspaceRepos(projects)
             state = states[number]
@@ -177,7 +177,8 @@
         self.create_branch('org/project2', 'stable/havana')
         self.create_branch('org/project4', 'stable/havana')
         A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
-        B = self.fake_gerrit.addFakeChange('org/project2', 'stable/havana', 'B')
+        B = self.fake_gerrit.addFakeChange('org/project2', 'stable/havana',
+                                           'B')
         C = self.fake_gerrit.addFakeChange('org/project3', 'master', 'C')
         A.addApproval('CRVW', 2)
         B.addApproval('CRVW', 2)
@@ -210,7 +211,7 @@
              'org/project4': str(upstream['org/project4'].
                                  commit('master')),
              },
-            ]
+        ]
 
         for number, build in enumerate(self.builds):
             self.log.debug("Build parameters: %s", build.parameters)
@@ -221,7 +222,7 @@
                 zuul_branch=build.parameters['ZUUL_BRANCH'],
                 zuul_ref=build.parameters['ZUUL_REF'],
                 zuul_url=self.git_root,
-                )
+            )
             cloner.execute()
             work = self.getWorkspaceRepos(projects)
             state = states[number]
@@ -249,9 +250,11 @@
         self.create_branch('org/project5', 'stable/havana')
         A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
         B = self.fake_gerrit.addFakeChange('org/project2', 'master', 'B')
-        C = self.fake_gerrit.addFakeChange('org/project3', 'stable/havana', 'C')
+        C = self.fake_gerrit.addFakeChange('org/project3', 'stable/havana',
+                                           'C')
         D = self.fake_gerrit.addFakeChange('org/project3', 'master', 'D')
-        E = self.fake_gerrit.addFakeChange('org/project4', 'stable/havana', 'E')
+        E = self.fake_gerrit.addFakeChange('org/project4', 'stable/havana',
+                                           'E')
         A.addApproval('CRVW', 2)
         B.addApproval('CRVW', 2)
         C.addApproval('CRVW', 2)
@@ -271,46 +274,61 @@
         upstream = self.getUpstreamRepos(projects)
         states = [
             {'org/project1': self.builds[0].parameters['ZUUL_COMMIT'],
-             'org/project2': str(upstream['org/project2'].commit('stable/havana')),
-             'org/project3': str(upstream['org/project3'].commit('stable/havana')),
-             'org/project4': str(upstream['org/project4'].commit('stable/havana')),
-             'org/project5': str(upstream['org/project5'].commit('stable/havana')),
+             'org/project2': str(upstream['org/project2'].commit(
+                                 'stable/havana')),
+             'org/project3': str(upstream['org/project3'].commit(
+                                 'stable/havana')),
+             'org/project4': str(upstream['org/project4'].commit(
+                                 'stable/havana')),
+             'org/project5': str(upstream['org/project5'].commit(
+                                 'stable/havana')),
              'org/project6': str(upstream['org/project6'].commit('master')),
              },
             {'org/project1': self.builds[0].parameters['ZUUL_COMMIT'],
-             'org/project2': str(upstream['org/project2'].commit('stable/havana')),
-             'org/project3': str(upstream['org/project3'].commit('stable/havana')),
-             'org/project4': str(upstream['org/project4'].commit('stable/havana')),
-             'org/project5': str(upstream['org/project5'].commit('stable/havana')),
+             'org/project2': str(upstream['org/project2'].commit(
+                                 'stable/havana')),
+             'org/project3': str(upstream['org/project3'].commit(
+                                 'stable/havana')),
+             'org/project4': str(upstream['org/project4'].commit(
+                                 'stable/havana')),
+             'org/project5': str(upstream['org/project5'].commit(
+                                 'stable/havana')),
              'org/project6': str(upstream['org/project6'].commit('master')),
              },
             {'org/project1': self.builds[0].parameters['ZUUL_COMMIT'],
-             'org/project2': str(upstream['org/project2'].commit('stable/havana')),
+             'org/project2': str(upstream['org/project2'].commit(
+                                 'stable/havana')),
              'org/project3': self.builds[2].parameters['ZUUL_COMMIT'],
-             'org/project4': str(upstream['org/project4'].commit('stable/havana')),
+             'org/project4': str(upstream['org/project4'].commit(
+                                 'stable/havana')),
 
-             'org/project5': str(upstream['org/project5'].commit('stable/havana')),
+             'org/project5': str(upstream['org/project5'].commit(
+                                 'stable/havana')),
              'org/project6': str(upstream['org/project6'].commit('master')),
              },
             {'org/project1': self.builds[0].parameters['ZUUL_COMMIT'],
-             'org/project2': str(upstream['org/project2'].commit('stable/havana')),
+             'org/project2': str(upstream['org/project2'].commit(
+                                 'stable/havana')),
              'org/project3': self.builds[2].parameters['ZUUL_COMMIT'],
-             'org/project4': str(upstream['org/project4'].commit('stable/havana')),
-             'org/project5': str(upstream['org/project5'].commit('stable/havana')),
+             'org/project4': str(upstream['org/project4'].commit(
+                                 'stable/havana')),
+             'org/project5': str(upstream['org/project5'].commit(
+                                 'stable/havana')),
              'org/project6': str(upstream['org/project6'].commit('master')),
              },
             {'org/project1': self.builds[0].parameters['ZUUL_COMMIT'],
-             'org/project2': str(upstream['org/project2'].commit('stable/havana')),
+             'org/project2': str(upstream['org/project2'].commit(
+                                 'stable/havana')),
              'org/project3': self.builds[2].parameters['ZUUL_COMMIT'],
              'org/project4': self.builds[4].parameters['ZUUL_COMMIT'],
-             'org/project5': str(upstream['org/project5'].commit('stable/havana')),
+             'org/project5': str(upstream['org/project5'].commit(
+                                 'stable/havana')),
              'org/project6': str(upstream['org/project6'].commit('master')),
              },
-            ]
+        ]
 
         for number, build in enumerate(self.builds):
             self.log.debug("Build parameters: %s", build.parameters)
-            change_number = int(build.parameters['ZUUL_CHANGE'])
             cloner = zuul.lib.cloner.Cloner(
                 git_base_url=self.upstream_root,
                 projects=projects,
@@ -318,8 +336,8 @@
                 zuul_branch=build.parameters['ZUUL_BRANCH'],
                 zuul_ref=build.parameters['ZUUL_REF'],
                 zuul_url=self.git_root,
-                branch='stable/havana', # Old branch for upgrade
-                )
+                branch='stable/havana',  # Old branch for upgrade
+            )
             cloner.execute()
             work = self.getWorkspaceRepos(projects)
             state = states[number]
@@ -369,11 +387,10 @@
              'org/project5': str(upstream['org/project5'].commit('master')),
              'org/project6': str(upstream['org/project6'].commit('master')),
              },
-            ]
+        ]
 
         for number, build in enumerate(self.builds):
             self.log.debug("Build parameters: %s", build.parameters)
-            change_number = int(build.parameters['ZUUL_CHANGE'])
             cloner = zuul.lib.cloner.Cloner(
                 git_base_url=self.upstream_root,
                 projects=projects,
@@ -381,8 +398,8 @@
                 zuul_branch=build.parameters['ZUUL_BRANCH'],
                 zuul_ref=build.parameters['ZUUL_REF'],
                 zuul_url=self.git_root,
-                branch='master', # New branch for upgrade
-                )
+                branch='master',  # New branch for upgrade
+            )
             cloner.execute()
             work = self.getWorkspaceRepos(projects)
             state = states[number]
@@ -410,7 +427,8 @@
         A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
         B = self.fake_gerrit.addFakeChange('org/project1', 'master', 'B')
         C = self.fake_gerrit.addFakeChange('org/project2', 'master', 'C')
-        D = self.fake_gerrit.addFakeChange('org/project3', 'stable/havana', 'D')
+        D = self.fake_gerrit.addFakeChange('org/project3', 'stable/havana',
+                                           'D')
         A.addApproval('CRVW', 2)
         B.addApproval('CRVW', 2)
         C.addApproval('CRVW', 2)
@@ -452,13 +470,13 @@
              'org/project3': self.builds[3].parameters['ZUUL_COMMIT'],
              'org/project4': str(upstream['org/project4'].commit('master')),
              'org/project5': str(upstream['org/project5'].commit('master')),
-             'org/project6': str(upstream['org/project6'].commit('stable/havana')),
+             'org/project6': str(upstream['org/project6'].commit(
+                                 'stable/havana')),
              },
-            ]
+        ]
 
         for number, build in enumerate(self.builds):
             self.log.debug("Build parameters: %s", build.parameters)
-            change_number = int(build.parameters['ZUUL_CHANGE'])
             cloner = zuul.lib.cloner.Cloner(
                 git_base_url=self.upstream_root,
                 projects=projects,
@@ -467,7 +485,7 @@
                 zuul_ref=build.parameters['ZUUL_REF'],
                 zuul_url=self.git_root,
                 project_branches={'org/project4': 'master'},
-                )
+            )
             cloner.execute()
             work = self.getWorkspaceRepos(projects)
             state = states[number]
@@ -514,11 +532,13 @@
 
         upstream = self.getUpstreamRepos(projects)
         states = [
-            {'org/project': str(upstream['org/project'].commit('stable/havana')),
+            {'org/project':
+                str(upstream['org/project'].commit('stable/havana')),
              },
-            {'org/project': str(upstream['org/project'].commit('stable/havana')),
+            {'org/project':
+                str(upstream['org/project'].commit('stable/havana')),
              },
-            ]
+        ]
 
         for number, build in enumerate(builds):
             self.log.debug("Build parameters: %s", build.parameters)
@@ -530,7 +550,7 @@
                 zuul_ref=build.parameters.get('ZUUL_REF', None),
                 zuul_url=self.git_root,
                 branch='stable/havana',
-                )
+            )
             cloner.execute()
             work = self.getWorkspaceRepos(projects)
             state = states[number]
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index a7548c1..89056f4 100755
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -1427,10 +1427,10 @@
         self.waitUntilSettled()
 
         # For debugging purposes...
-        #for pipeline in self.sched.layout.pipelines.values():
-        #    for queue in pipeline.queues:
-        #        self.log.info("pipepline %s queue %s contents %s" % (
-        #            pipeline.name, queue.name, queue.queue))
+        # for pipeline in self.sched.layout.pipelines.values():
+        #     for queue in pipeline.queues:
+        #         self.log.info("pipepline %s queue %s contents %s" % (
+        #             pipeline.name, queue.name, queue.queue))
 
         self.worker.release('.*-merge')
         self.waitUntilSettled()
diff --git a/tests/test_zuultrigger.py b/tests/test_zuultrigger.py
index 9a90a98..3f339be 100644
--- a/tests/test_zuultrigger.py
+++ b/tests/test_zuultrigger.py
@@ -15,7 +15,6 @@
 # under the License.
 
 import logging
-import time
 
 from tests.base import ZuulTestCase
 
@@ -46,9 +45,9 @@
         A.addApproval('CRVW', 2)
         B1.addApproval('CRVW', 2)
         B2.addApproval('CRVW', 2)
-        A.addApproval('VRFY', 1)  # required by gate
-        B1.addApproval('VRFY', -1) # should go to check
-        B2.addApproval('VRFY', 1)  # should go to gate
+        A.addApproval('VRFY', 1)    # required by gate
+        B1.addApproval('VRFY', -1)  # should go to check
+        B2.addApproval('VRFY', 1)   # should go to gate
         B1.addApproval('APRV', 1)
         B2.addApproval('APRV', 1)
         B1.setDependsOn(A, 1)
@@ -106,11 +105,14 @@
         self.assertEqual(C.reported, 0)
         self.assertEqual(D.reported, 0)
         self.assertEqual(E.reported, 0)
-        self.assertEqual(B.messages[0],
+        self.assertEqual(
+            B.messages[0],
             "Merge Failed.\n\nThis change was unable to be automatically "
             "merged with the current state of the repository. Please rebase "
             "your change and upload a new patchset.")
-        self.assertEqual(self.fake_gerrit.queries[0], "project:org/project status:open")
+
+        self.assertEqual(self.fake_gerrit.queries[0],
+                         "project:org/project status:open")
 
         # Reconfigure and run the test again.  This is a regression
         # check to make sure that we don't end up with a stale trigger
@@ -129,8 +131,10 @@
         self.assertEqual(C.reported, 0)
         self.assertEqual(D.reported, 2)
         self.assertEqual(E.reported, 1)
-        self.assertEqual(E.messages[0],
+        self.assertEqual(
+            E.messages[0],
             "Merge Failed.\n\nThis change was unable to be automatically "
             "merged with the current state of the repository. Please rebase "
             "your change and upload a new patchset.")
-        self.assertEqual(self.fake_gerrit.queries[1], "project:org/project status:open")
+        self.assertEqual(self.fake_gerrit.queries[1],
+                         "project:org/project status:open")