on xenial help sign in
More flake8 fixes.
9821adeLeo Arias
.bazaar/plugins/makecheck_unity_phablet.py+16−8
@@ -1,5 +1,5 @@
1#!/usr/bin/python
1#!/usr/bin/python
2−# Copyright 2013 Canonical Ltd.
2+# Copyright 2013, 2014 Canonical Ltd.
3#
3#
4# This program is free software; you can redistribute it and/or modify
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU Lesser General Public License as published by
5# it under the terms of the GNU Lesser General Public License as published by
@@ -13,11 +13,15 @@
13# You should have received a copy of the GNU Lesser General Public License
13# You should have received a copy of the GNU Lesser General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
16−import os, subprocess
16+import os
17+import subprocess
17−from bzrlib import branch, errors
18+from bzrlib import branch
18−from bzrlib.urlutils import dirname, local_path_from_url
19+from bzrlib.urlutils import local_path_from_url
19
20
21+
22+def execute_makecheck(
23+ local_branch, master_branch, old_revision_number, old_revision_id,
20−def execute_makecheck(local_branch, master_branch, old_revision_number, old_revision_id, future_revision_number, future_revision_id, tree_delta, future_tree):
24+ future_revision_number, future_revision_id, tree_delta, future_tree):
21 if not master_branch.basis_tree().has_filename("qml/Shell.qml"):
25 if not master_branch.basis_tree().has_filename("qml/Shell.qml"):
22 return
26 return
23
27
@@ -27,7 +31,9 @@ def execute_makecheck(local_branch, master_branch, old_revision_number, old_revi
27 os.environ['CTEST_OUTPUT_ON_FAILURE'] = "1"
31 os.environ['CTEST_OUTPUT_ON_FAILURE'] = "1"
28 if (subprocess.call("make -C builddir test", shell=True) != 0):
32 if (subprocess.call("make -C builddir test", shell=True) != 0):
29
33
34+ print("\n\n*** Warning ***\n\n"
30− print("\n\n*** Warning ***\n\nBasic tests failed. This commit will not pass continuous integration.")
35+ "Basic tests failed. This commit will not pass continuous "
36+ "integration.")
31
37
32 branch = local_branch or master_branch
38 branch = local_branch or master_branch
33 revision = branch.repository.get_revision(future_revision_id)
39 revision = branch.repository.get_revision(future_revision_id)
@@ -36,8 +42,10 @@ def execute_makecheck(local_branch, master_branch, old_revision_number, old_revi
36 msg_file.close()
42 msg_file.close()
37
43
38 print("\n\nSaved commit message to $SRC_DIR/message.txt.")
44 print("\n\nSaved commit message to $SRC_DIR/message.txt.")
39− print("You can uncommit this revision, fix the tests and reuse your message running:\n\nbzr commit -F message.txt\n\n")
45+ print("You can uncommit this revision, fix the tests and reuse your "
46+ "message running:\n\nbzr commit -F message.txt\n\n")
40 elif os.path.isfile("message.txt"):
47 elif os.path.isfile("message.txt"):
41 os.remove("message.txt")
48 os.remove("message.txt")
42
49
50+branch.Branch.hooks.install_named_hook(
43−branch.Branch.hooks.install_named_hook('pre_commit', execute_makecheck, 'make check pre-commit')
51+ 'pre_commit', execute_makecheck, 'make check pre-commit')
tests/autopilot/unity8/process_helpers.py+1−1
@@ -173,7 +173,7 @@ def _get_unity_status():
173
173
174def _get_unity_pid():
174def _get_unity_pid():
175 status = _get_unity_status()
175 status = _get_unity_status()
176− if not "start/" in status:
176+ if "start/" not in status:
177 raise CannotAccessUnity("Unity is not in the running state.")
177 raise CannotAccessUnity("Unity is not in the running state.")
178 return int(status.split()[-1])
178 return int(status.split()[-1])
179
179
tests/autopilot/unity8/shell/tests/__init__.py+1−2
@@ -142,12 +142,11 @@ class UnityTestCase(AutopilotTestCase):
142 self._data_dirs_mock_enabled = True
142 self._data_dirs_mock_enabled = True
143 self._environment = {}
143 self._environment = {}
144
144
145− #### FIXME: This is a work around re: lp:1238417 ####
145+ # FIXME: This is a work around re: lp:1238417
146 if model() != "Desktop":
146 if model() != "Desktop":
147 from autopilot.input import _uinput
147 from autopilot.input import _uinput
148 _uinput._touch_device = _uinput.create_touch_device()
148 _uinput._touch_device = _uinput.create_touch_device()
149 self.addCleanup(_uinput._touch_device.close)
149 self.addCleanup(_uinput._touch_device.close)
150− ####
151
150
152 self.touch = Touch.create()
151 self.touch = Touch.create()
153 self._setup_display_details()
152 self._setup_display_details()