Merge lp:~elopio/autopilot/fix1201057-pep8-8 into lp:autopilot
- fix1201057-pep8-8
- Merge into trunk
Proposed by
Leo Arias
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Thomi Richards | ||||
Approved revision: | 300 | ||||
Merged at revision: | 282 | ||||
Proposed branch: | lp:~elopio/autopilot/fix1201057-pep8-8 | ||||
Merge into: | lp:autopilot | ||||
Prerequisite: | lp:~elopio/autopilot/fix1201057-pep8-7 | ||||
Diff against target: |
1100 lines (+276/-198) 12 files modified
autopilot/__init__.py (+46/-43) autopilot/clipboard.py (+2/-2) autopilot/dbus_handler.py (+1/-1) autopilot/emulators.py (+5/-7) autopilot/gestures.py (+6/-4) autopilot/globals.py (+20/-11) autopilot/ibus.py (+14/-12) autopilot/keybindings.py (+29/-19) autopilot/platform.py (+13/-11) autopilot/testcase.py (+98/-66) autopilot/testresult.py (+2/-1) autopilot/utilities.py (+40/-21) |
||||
To merge this branch: | bzr merge lp:~elopio/autopilot/fix1201057-pep8-8 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Thomi Richards (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+176113@code.launchpad.net |
Commit message
Fixed pep8 errors in the autopilot folder.
Description of the change
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Approve
(continuous-integration)
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote : | # |
LGTM
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'autopilot/__init__.py' |
2 | --- autopilot/__init__.py 2013-07-04 08:24:55 +0000 |
3 | +++ autopilot/__init__.py 2013-07-22 04:44:44 +0000 |
4 | @@ -29,9 +29,8 @@ |
5 | |
6 | def __init__(self, original_exception): |
7 | super(BackendException, self).__init__( |
8 | - "Error while initialising backend. Original exception was: " \ |
9 | - + original_exception.message |
10 | - ) |
11 | + "Error while initialising backend. Original exception was: " + |
12 | + original_exception.message) |
13 | self.original_exception = original_exception |
14 | |
15 | |
16 | @@ -70,49 +69,51 @@ |
17 | parser_run.add_argument("-ro", "--random-order", action='store_true', |
18 | required=False, default=False, |
19 | help="Run the tests in random order") |
20 | - parser_run.add_argument('-v', '--verbose', default=False, required=False, |
21 | - action='count', |
22 | - help="If set, autopilot will output test log data \ |
23 | - to stderr during a test run. Set twice to also log \ |
24 | - data useful for debugging autopilot itself.") |
25 | + parser_run.add_argument( |
26 | + '-v', '--verbose', default=False, required=False, action='count', |
27 | + help="If set, autopilot will output test log data to stderr during a " |
28 | + "test run. Set twice to also log data useful for debugging autopilot " |
29 | + "itself.") |
30 | parser_run.add_argument("suite", nargs="+", |
31 | help="Specify test suite(s) to run.") |
32 | |
33 | parser_list = subparsers.add_parser('list', help="List autopilot tests") |
34 | - parser_list.add_argument("-ro", "--run-order", required=False, default=False, |
35 | - action="store_true", |
36 | - help="List tests in run order, rather than alphabetical \ |
37 | - order (the default).") |
38 | - parser_list.add_argument("--suites", required=False, action='store_true', |
39 | - help="Lists only available suites, not tests contained \ |
40 | - within the suite.") |
41 | + parser_list.add_argument( |
42 | + "-ro", "--run-order", required=False, default=False, |
43 | + action="store_true", |
44 | + help="List tests in run order, rather than alphabetical order (the " |
45 | + "default).") |
46 | + parser_list.add_argument( |
47 | + "--suites", required=False, action='store_true', |
48 | + help="Lists only available suites, not tests contained within the " |
49 | + "suite.") |
50 | parser_list.add_argument("suite", nargs="+", |
51 | help="Specify test suite(s) to run.") |
52 | |
53 | if have_vis(): |
54 | - parser_vis = subparsers.add_parser('vis', |
55 | - help="Open the Autopilot visualiser tool") |
56 | - parser_vis.add_argument('-v', '--verbose', required=False, default=False, |
57 | - action='count', help="Show autopilot log messages. \ |
58 | - Set twice to also log data useful for debugging \ |
59 | - autopilot itself.") |
60 | + parser_vis = subparsers.add_parser( |
61 | + 'vis', help="Open the Autopilot visualiser tool") |
62 | + parser_vis.add_argument( |
63 | + '-v', '--verbose', required=False, default=False, action='count', |
64 | + help="Show autopilot log messages. Set twice to also log data " |
65 | + "useful for debugging autopilot itself.") |
66 | |
67 | - parser_launch = subparsers.add_parser('launch', |
68 | - help="Launch an application with introspection enabled") |
69 | - parser_launch.add_argument('-i', '--interface', |
70 | - choices=('Gtk', 'Qt', 'Auto'), default='Auto', |
71 | - help="Specify which introspection interface to load. \ |
72 | - The default ('Auto') uses ldd to try and detect which \ |
73 | - interface to load.") |
74 | - parser_launch.add_argument('-v', '--verbose', required=False, default=False, |
75 | - action='count', help="Show autopilot log messages. \ |
76 | - Set twice to also log data useful for debugging \ |
77 | - autopilot itself.") |
78 | - parser_launch.add_argument('application', action=_OneOrMoreArgumentStoreAction, |
79 | - type=str, nargs=REMAINDER, |
80 | - help="The application to launch. Can be a full path, \ |
81 | - or just an application name (in which case Autopilot \ |
82 | - will search for it in $PATH).") |
83 | + parser_launch = subparsers.add_parser( |
84 | + 'launch', help="Launch an application with introspection enabled") |
85 | + parser_launch.add_argument( |
86 | + '-i', '--interface', choices=('Gtk', 'Qt', 'Auto'), default='Auto', |
87 | + help="Specify which introspection interface to load. The default" |
88 | + "('Auto') uses ldd to try and detect which interface to load.") |
89 | + parser_launch.add_argument( |
90 | + '-v', '--verbose', required=False, default=False, action='count', |
91 | + help="Show autopilot log messages. Set twice to also log data useful " |
92 | + "for debugging autopilot itself.") |
93 | + parser_launch.add_argument( |
94 | + 'application', action=_OneOrMoreArgumentStoreAction, type=str, |
95 | + nargs=REMAINDER, |
96 | + help="The application to launch. Can be a full path, or just an " |
97 | + "application name (in which case Autopilot will search for it in " |
98 | + "$PATH).") |
99 | args = parser.parse_args(args=argv) |
100 | |
101 | return args |
102 | @@ -122,7 +123,8 @@ |
103 | |
104 | def __call__(self, parser, namespace, values, option_string=None): |
105 | if len(values) == 0: |
106 | - parser.error("Must specify at least one argument to the 'launch' command") |
107 | + parser.error( |
108 | + "Must specify at least one argument to the 'launch' command") |
109 | setattr(namespace, self.dest, values) |
110 | |
111 | |
112 | @@ -159,13 +161,14 @@ |
113 | |
114 | |
115 | def _running_in_system(): |
116 | - """Return True if we're running autopilot from the system installation dir.""" |
117 | + """Return True if we're running autopilot from the system installation |
118 | + dir.""" |
119 | return __file__.startswith('/usr/') |
120 | |
121 | |
122 | def _get_package_installed_version(): |
123 | - """Get the version string of the system-wide installed package, or None if it |
124 | - is not installed. |
125 | + """Get the version string of the system-wide installed package, or None if |
126 | + it is not installed. |
127 | |
128 | """ |
129 | try: |
130 | @@ -176,7 +179,7 @@ |
131 | "${Version}", |
132 | "--show", |
133 | "python-autopilot", |
134 | - ] |
135 | - ).strip() |
136 | + ] |
137 | + ).strip() |
138 | except subprocess.CalledProcessError: |
139 | return None |
140 | |
141 | === modified file 'autopilot/clipboard.py' |
142 | --- autopilot/clipboard.py 2013-07-19 07:03:40 +0000 |
143 | +++ autopilot/clipboard.py 2013-07-22 04:44:44 +0000 |
144 | @@ -24,8 +24,8 @@ |
145 | def get_clipboard_contents(): |
146 | """Get the contents of the clipboard. |
147 | |
148 | - This function returns the text copied to the 'CLIPBOARD' clipboard. Text can |
149 | - be added to this clipbaord using Ctrl+C. |
150 | + This function returns the text copied to the 'CLIPBOARD' clipboard. Text |
151 | + can be added to this clipbaord using Ctrl+C. |
152 | |
153 | """ |
154 | from gi import require_version |
155 | |
156 | === modified file 'autopilot/dbus_handler.py' |
157 | --- autopilot/dbus_handler.py 2013-05-02 16:29:44 +0000 |
158 | +++ autopilot/dbus_handler.py 2013-07-22 04:44:44 +0000 |
159 | @@ -26,6 +26,7 @@ |
160 | import dbus |
161 | from dbus.mainloop.glib import DBusGMainLoop |
162 | |
163 | + |
164 | _glib_loop_set = False |
165 | |
166 | # DBus has an annoying bug where we need to initialise it with the gobject main |
167 | @@ -65,4 +66,3 @@ |
168 | """ |
169 | _ensure_glib_loop_set() |
170 | return BusConnection(bus_address) |
171 | - |
172 | |
173 | === modified file 'autopilot/emulators.py' |
174 | --- autopilot/emulators.py 2013-04-27 05:23:05 +0000 |
175 | +++ autopilot/emulators.py 2013-07-22 04:44:44 +0000 |
176 | @@ -21,12 +21,12 @@ |
177 | """ |
178 | .. otto:: **Deprecated Namespace!** |
179 | |
180 | - This module contains modules that were in the ``autopilot.emulators`` package in |
181 | - autopilot version 1.2 and earlier, but have now been moved to the ``autopilot`` |
182 | - package. |
183 | + This module contains modules that were in the ``autopilot.emulators`` |
184 | + package in autopilot version 1.2 and earlier, but have now been moved to |
185 | + the ``autopilot`` package. |
186 | |
187 | - This module exists to ease the transition to autopilot 1.3, but is not guaranteed |
188 | - to exist in the future. |
189 | + This module exists to ease the transition to autopilot 1.3, but is not |
190 | + guaranteed to exist in the future. |
191 | |
192 | .. seealso:: |
193 | |
194 | @@ -42,5 +42,3 @@ |
195 | import autopilot.dbus_handler as dbus_handler |
196 | import autopilot.ibus as ibus |
197 | import autopilot.input as input |
198 | - |
199 | - |
200 | |
201 | === modified file 'autopilot/gestures.py' |
202 | --- autopilot/gestures.py 2013-04-27 05:23:05 +0000 |
203 | +++ autopilot/gestures.py 2013-07-22 04:44:44 +0000 |
204 | @@ -21,8 +21,8 @@ |
205 | """Gestural support for autopilot. |
206 | |
207 | This module contains functions that can generate touch and multi-touch gestures |
208 | -for you. This is a convenience for the test author - there is nothing to prevent |
209 | -you from generating your own gestures! |
210 | +for you. This is a convenience for the test author - there is nothing to |
211 | +prevent you from generating your own gestures! |
212 | |
213 | """ |
214 | |
215 | @@ -34,8 +34,10 @@ |
216 | """Perform a two finger pinch (zoom) gesture. |
217 | |
218 | :param center: The coordinates (x,y) of the center of the pinch gesture. |
219 | - :param vector_start: The (x,y) values to move away from the center for the start. |
220 | - :param vector_end: The (x,y) values to move away from the center for the end. |
221 | + :param vector_start: The (x,y) values to move away from the center for the |
222 | + start. |
223 | + :param vector_end: The (x,y) values to move away from the center for the |
224 | + end. |
225 | |
226 | The fingers will move in 100 steps between the start and the end points. |
227 | If start is smaller than end, the gesture will zoom in, otherwise it |
228 | |
229 | === modified file 'autopilot/globals.py' |
230 | --- autopilot/globals.py 2013-07-10 02:20:44 +0000 |
231 | +++ autopilot/globals.py 2013-07-22 04:44:44 +0000 |
232 | @@ -72,7 +72,8 @@ |
233 | root_logger = logging.getLogger() |
234 | self._log_handler.flush() |
235 | self._log_buffer.seek(0) |
236 | - test_instance.addDetail('test-log', text_content(self._log_buffer.getvalue())) |
237 | + test_instance.addDetail( |
238 | + 'test-log', text_content(self._log_buffer.getvalue())) |
239 | root_logger.removeHandler(self._log_handler) |
240 | self._log_buffer = None |
241 | |
242 | @@ -92,7 +93,7 @@ |
243 | """Video capture autopilot tests, saving the results if the test failed.""" |
244 | |
245 | _recording_app = '/usr/bin/recordmydesktop' |
246 | - _recording_opts = ['--no-sound', '--no-frame', '-o',] |
247 | + _recording_opts = ['--no-sound', '--no-frame', '-o'] |
248 | |
249 | def __init__(self): |
250 | self._enable_recording = False |
251 | @@ -100,13 +101,18 @@ |
252 | |
253 | def __call__(self, test_instance): |
254 | if not self._have_recording_app(): |
255 | - logger.warning("Disabling video capture since '%s' is not present", self._recording_app) |
256 | + logger.warning( |
257 | + "Disabling video capture since '%s' is not present", |
258 | + self._recording_app) |
259 | |
260 | if self._currently_recording_description is not None: |
261 | - logger.warning("Video capture already in progress for %s", self._currently_recording_description) |
262 | + logger.warning( |
263 | + "Video capture already in progress for %s", |
264 | + self._currently_recording_description) |
265 | return |
266 | |
267 | - self._currently_recording_description = test_instance.shortDescription() |
268 | + self._currently_recording_description = \ |
269 | + test_instance.shortDescription() |
270 | self._test_passed = True |
271 | test_instance.addOnException(self._on_test_failed) |
272 | test_instance.addCleanup(self._stop_video_capture, test_instance) |
273 | @@ -136,7 +142,7 @@ |
274 | self._capture_file = os.path.join( |
275 | self.recording_directory, |
276 | '%s.ogv' % (test_id) |
277 | - ) |
278 | + ) |
279 | self._ensure_directory_exists_but_not_file(self._capture_file) |
280 | args.append(self._capture_file) |
281 | logger.debug("Starting: %r", args) |
282 | @@ -144,10 +150,11 @@ |
283 | args, |
284 | stdout=subprocess.PIPE, |
285 | stderr=subprocess.STDOUT |
286 | - ) |
287 | + ) |
288 | |
289 | def _stop_video_capture(self, test_instance): |
290 | - """Stop the video capture. If the test failed, save the resulting file.""" |
291 | + """Stop the video capture. If the test failed, save the resulting |
292 | + file.""" |
293 | |
294 | if self._test_passed: |
295 | # We use kill here because we don't want the recording app to start |
296 | @@ -158,7 +165,9 @@ |
297 | self._capture_process.terminate() |
298 | self._capture_process.wait() |
299 | if self._capture_process.returncode != 0: |
300 | - test_instance.addDetail('video capture log', text_content(self._capture_process.stdout.read())) |
301 | + test_instance.addDetail( |
302 | + 'video capture log', |
303 | + text_content(self._capture_process.stdout.read())) |
304 | self._capture_process = None |
305 | self._currently_recording_description = None |
306 | |
307 | @@ -170,7 +179,8 @@ |
308 | if not os.path.exists(dirpath): |
309 | os.makedirs(dirpath) |
310 | elif os.path.exists(file_path): |
311 | - logger.warning("Video capture file '%s' already exists, deleting.", file_path) |
312 | + logger.warning( |
313 | + "Video capture file '%s' already exists, deleting.", file_path) |
314 | os.remove(file_path) |
315 | |
316 | def _on_test_failed(self, ex_info): |
317 | @@ -199,4 +209,3 @@ |
318 | _video_logger.enable_recording(enable_recording) |
319 | _video_logger.set_recording_dir(record_dir) |
320 | _video_logger.set_recording_opts(record_opts) |
321 | - |
322 | |
323 | === modified file 'autopilot/ibus.py' |
324 | --- autopilot/ibus.py 2013-04-23 04:15:54 +0000 |
325 | +++ autopilot/ibus.py 2013-07-22 04:44:44 +0000 |
326 | @@ -54,7 +54,8 @@ |
327 | main_loop.run() |
328 | |
329 | if not bus.is_connected(): |
330 | - raise RuntimeError("Could not start ibus-daemon after %d seconds." % (timeout)) |
331 | + raise RuntimeError( |
332 | + "Could not start ibus-daemon after %d seconds." % (timeout)) |
333 | return bus |
334 | |
335 | |
336 | @@ -79,9 +80,9 @@ |
337 | |
338 | .. note:: This function removes all other engines. |
339 | |
340 | - This function returns the list of engines installed before this function was |
341 | - called. The caller should pass this list to set_active_engines to restore |
342 | - ibus to it's old state once the test has finished. |
343 | + This function returns the list of engines installed before this function |
344 | + was called. The caller should pass this list to set_active_engines to |
345 | + restore ibus to it's old state once the test has finished. |
346 | |
347 | :param engine_list: List of engine names |
348 | :type engine_list: List of strings |
349 | @@ -96,7 +97,8 @@ |
350 | if not isinstance(engine, basestring): |
351 | raise TypeError("Engines in engine_list must all be strings.") |
352 | if engine not in available_engines: |
353 | - raise ValueError("engine_list contains invalid engine name: '%s'", engine) |
354 | + raise ValueError( |
355 | + "engine_list contains invalid engine name: '%s'", engine) |
356 | |
357 | bus = get_ibus_bus() |
358 | config = bus.get_config() |
359 | @@ -106,20 +108,18 @@ |
360 | GLib.Variant.new_int32(IBus.PreloadEngineMode.USER)) |
361 | |
362 | old_engines = get_active_input_engines() |
363 | - config.set_value("general", |
364 | - "preload_engines", |
365 | - GLib.Variant("as", engine_list) |
366 | - ) |
367 | + config.set_value( |
368 | + "general", "preload_engines", GLib.Variant("as", engine_list)) |
369 | # need to restart the ibus bus before it'll pick up the new engine. |
370 | # see bug report here: |
371 | - # http://code.google.com/p/ibus/issues/detail?id=1418&thanks=1418&ts=1329885137 |
372 | + # http://code.google.com/p/ibus/issues/detail?id=1418 |
373 | bus.exit(restart=True) |
374 | return old_engines |
375 | |
376 | |
377 | def set_gconf_option(path, value): |
378 | """Set the gconf setting on `path` to the defined `value`""" |
379 | - _set_gconf_list (path, value) |
380 | + _set_gconf_list(path, value) |
381 | |
382 | |
383 | def get_gconf_option(path): |
384 | @@ -131,7 +131,9 @@ |
385 | |
386 | def _set_gconf_list(path, values): |
387 | gconf_value = '[%s]' % ','.join(values) |
388 | - subprocess.check_output(["gconftool-2", "--set", "--type=list", "--list-type=string", path, gconf_value]) |
389 | + subprocess.check_output( |
390 | + ["gconftool-2", "--set", "--type=list", "--list-type=string", path, |
391 | + gconf_value]) |
392 | |
393 | |
394 | def _get_native_gconf_value(value): |
395 | |
396 | === modified file 'autopilot/keybindings.py' |
397 | --- autopilot/keybindings.py 2013-04-23 04:15:54 +0000 |
398 | +++ autopilot/keybindings.py 2013-07-22 04:44:44 +0000 |
399 | @@ -21,8 +21,8 @@ |
400 | """Utility functions to get shortcut keybindings for various parts of Unity. |
401 | |
402 | Inside Autopilot we deal with keybindings by naming them with unique names. For |
403 | -example, instead of hard-coding the fact that 'Alt+F2' opens the command lens, we |
404 | -might call: |
405 | +example, instead of hard-coding the fact that 'Alt+F2' opens the command lens, |
406 | +we might call: |
407 | |
408 | >>> keybindings.get('lens_reveal/command') |
409 | 'Alt+F2' |
410 | @@ -117,7 +117,7 @@ |
411 | "workspace/move_up": ("wall", "up_key"), |
412 | "workspace/move_down": ("wall", "down_key"), |
413 | # Window management: |
414 | - "window/show_desktop" : ("core", "show_desktop_key"), |
415 | + "window/show_desktop": ("core", "show_desktop_key"), |
416 | "window/minimize": ("core", "minimize_window_key"), |
417 | "window/maximize": ("core", "maximize_window_key"), |
418 | "window/restore": ("core", "unmaximize_or_minimize_window_key"), |
419 | @@ -131,7 +131,6 @@ |
420 | } |
421 | |
422 | |
423 | - |
424 | def get(binding_name): |
425 | """Get a keybinding, given its well-known name. |
426 | |
427 | @@ -154,8 +153,8 @@ |
428 | def get_hold_part(binding_name): |
429 | """Returns the part of a keybinding that must be held permanently. |
430 | |
431 | - Use this function to split bindings like "Alt+Tab" into the part that must be |
432 | - held down. See :meth:`get_tap_part` for the part that must be tapped. |
433 | + Use this function to split bindings like "Alt+Tab" into the part that must |
434 | + be held down. See :meth:`get_tap_part` for the part that must be tapped. |
435 | |
436 | :raises: **ValueError** if the binding specified does not have multiple |
437 | parts. |
438 | @@ -164,7 +163,8 @@ |
439 | binding = get(binding_name) |
440 | parts = binding.split('+') |
441 | if len(parts) == 1: |
442 | - logger.warning("Key binding '%s' does not have a hold part.", binding_name) |
443 | + logger.warning( |
444 | + "Key binding '%s' does not have a hold part.", binding_name) |
445 | return parts[0] |
446 | return '+'.join(parts[:-1]) |
447 | |
448 | @@ -172,8 +172,9 @@ |
449 | def get_tap_part(binding_name): |
450 | """Returns the part of a keybinding that must be tapped. |
451 | |
452 | - Use this function to split bindings like "Alt+Tab" into the part that must be |
453 | - held tapped. See :meth:`get_hold_part` for the part that must be held down. |
454 | + Use this function to split bindings like "Alt+Tab" into the part that must |
455 | + be held tapped. See :meth:`get_hold_part` for the part that must be held |
456 | + down. |
457 | |
458 | :Raises: **ValueError** if the binding specified does not have multiple |
459 | parts. |
460 | @@ -182,13 +183,15 @@ |
461 | binding = get(binding_name) |
462 | parts = binding.split('+') |
463 | if len(parts) == 1: |
464 | - logger.warning("Key binding '%s' does not have a tap part.", binding_name) |
465 | + logger.warning( |
466 | + "Key binding '%s' does not have a tap part.", binding_name) |
467 | return parts[0] |
468 | return parts[-1] |
469 | |
470 | |
471 | def _get_compiz_keybinding(compiz_tuple): |
472 | - """Given a keybinding name, get the keybinding string from the compiz option. |
473 | + """Given a keybinding name, get the keybinding string from the compiz |
474 | + option. |
475 | |
476 | :raises: **ValueError** if the compiz setting described does not hold a |
477 | keybinding. |
478 | @@ -199,13 +202,17 @@ |
479 | plugin = _get_compiz_plugin(plugin_name) |
480 | setting = _get_compiz_setting(plugin_name, setting_name) |
481 | if setting.Type != 'Key': |
482 | - raise ValueError("Key binding maps to a compiz option that does not hold a keybinding.") |
483 | + raise ValueError( |
484 | + "Key binding maps to a compiz option that does not hold a " |
485 | + "keybinding.") |
486 | if not plugin.Enabled: |
487 | - logger.warning("Returning keybinding for '%s' which is in un-enabled plugin '%s'", |
488 | + logger.warning( |
489 | + "Returning keybinding for '%s' which is in un-enabled plugin '%s'", |
490 | setting.ShortDesc, |
491 | plugin.ShortDesc) |
492 | if setting.Value == "Disabled": |
493 | - raise RuntimeError("Keybinding '%s' in compiz plugin '%s' has been disabled." % |
494 | + raise RuntimeError( |
495 | + "Keybinding '%s' in compiz plugin '%s' has been disabled." % |
496 | (setting.ShortDesc, plugin.ShortDesc)) |
497 | |
498 | return _translate_compiz_keystroke_string(setting.Value) |
499 | @@ -254,7 +261,8 @@ |
500 | |
501 | """ |
502 | if type(delay) not in (float, NoneType): |
503 | - raise TypeError("delay parameter must be a float if it is defined.") |
504 | + raise TypeError( |
505 | + "delay parameter must be a float if it is defined.") |
506 | if delay: |
507 | self._keyboard.press_and_release(get(binding_name), delay) |
508 | else: |
509 | @@ -282,6 +290,7 @@ |
510 | # future. |
511 | _global_compiz_context = None |
512 | |
513 | + |
514 | def _get_global_compiz_context(): |
515 | """Get the compizconfig global context object.""" |
516 | global _global_compiz_context |
517 | @@ -303,7 +312,8 @@ |
518 | try: |
519 | return ctx.Plugins[plugin_name] |
520 | except KeyError: |
521 | - raise KeyError("Compiz plugin '%s' does not exist." % (plugin_name)) |
522 | + raise KeyError( |
523 | + "Compiz plugin '%s' does not exist." % (plugin_name)) |
524 | |
525 | |
526 | def _get_compiz_setting(plugin_name, setting_name): |
527 | @@ -317,6 +327,6 @@ |
528 | try: |
529 | return plugin.Screen[setting_name] |
530 | except KeyError: |
531 | - raise KeyError("Compiz setting '%s' does not exist in plugin '%s'." % (setting_name, plugin_name)) |
532 | - |
533 | - |
534 | + raise KeyError( |
535 | + "Compiz setting '%s' does not exist in plugin '%s'." % |
536 | + (setting_name, plugin_name)) |
537 | |
538 | === modified file 'autopilot/platform.py' |
539 | --- autopilot/platform.py 2013-04-27 05:00:37 +0000 |
540 | +++ autopilot/platform.py 2013-07-22 04:44:44 +0000 |
541 | @@ -22,9 +22,10 @@ |
542 | Platform identification utilities for Autopilot. |
543 | ================================================ |
544 | |
545 | -This module provides functions that give test authors hints as to which platform |
546 | -their tests are currently running on. This is useful when a test needs to test |
547 | -slight different behavior depending on the system it's running on. For example:: |
548 | +This module provides functions that give test authors hints as to which |
549 | +platform their tests are currently running on. This is useful when a test |
550 | +needs to test slight different behavior depending on the system it's running |
551 | +on. For example:: |
552 | |
553 | from autopilot import platform |
554 | |
555 | @@ -39,10 +40,11 @@ |
556 | Skipping tests based on Platform |
557 | ++++++++++++++++++++++++++++++++ |
558 | |
559 | -Sometimes you want a test to not run on certain platforms, or only run on certain |
560 | -platforms. This can be easily achieved with a combination of the functions in this |
561 | -module and the ``skipIf`` and ``skipUnless`` decorators. For example, to define |
562 | -a test that only runs on the galaxy nexus device, write this:: |
563 | +Sometimes you want a test to not run on certain platforms, or only run on |
564 | +certain platforms. This can be easily achieved with a combination of the |
565 | +functions in this module and the ``skipIf`` and ``skipUnless`` decorators. For |
566 | +example, to define a test that only runs on the galaxy nexus device, write |
567 | +this:: |
568 | |
569 | from testtools import skipUnless |
570 | |
571 | @@ -109,7 +111,8 @@ |
572 | |
573 | @staticmethod |
574 | def create(): |
575 | - """Create a platform detector object, or return one we baked earlier.""" |
576 | + """Create a platform detector object, or return one we baked |
577 | + earlier.""" |
578 | if _PlatformDetector._cached_detector is None: |
579 | _PlatformDetector._cached_detector = _PlatformDetector() |
580 | return _PlatformDetector._cached_detector |
581 | @@ -130,8 +133,8 @@ |
582 | |
583 | |
584 | def _get_property_file(): |
585 | - """Return a file-like object that contains the contents of the build properties |
586 | - file, if it exists, or None. |
587 | + """Return a file-like object that contains the contents of the build |
588 | + properties file, if it exists, or None. |
589 | |
590 | """ |
591 | if exists('/system/build.prop'): |
592 | @@ -159,4 +162,3 @@ |
593 | |
594 | properties[key] = value |
595 | return properties |
596 | - |
597 | |
598 | === modified file 'autopilot/testcase.py' |
599 | --- autopilot/testcase.py 2013-05-30 12:00:24 +0000 |
600 | +++ autopilot/testcase.py 2013-07-22 04:44:44 +0000 |
601 | @@ -22,17 +22,17 @@ |
602 | Quick Start |
603 | =========== |
604 | |
605 | -The :class:`AutopilotTestCase` is the main class test authors will be interacting |
606 | -with. Every autopilot test case should derive from this class. |
607 | +The :class:`AutopilotTestCase` is the main class test authors will be |
608 | +interacting with. Every autopilot test case should derive from this class. |
609 | :class:`AutopilotTestCase` derives from :class:`testtools.TestCase`, so test |
610 | authors can use all the methods defined in that class as well. |
611 | |
612 | **Writing tests** |
613 | |
614 | Tests must be named: ``test_<testname>``, where *<testname>* is the name of the |
615 | -test. Test runners (including autopilot itself) look for methods with this naming |
616 | -convention. It is recommended that you make your test names descriptive of what |
617 | -each test is testing. For example, possible test names include:: |
618 | +test. Test runners (including autopilot itself) look for methods with this |
619 | +naming convention. It is recommended that you make your test names descriptive |
620 | +of what each test is testing. For example, possible test names include:: |
621 | |
622 | test_ctrl_p_opens_print_dialog |
623 | test_dash_remembers_maximized_state |
624 | @@ -66,16 +66,16 @@ |
625 | get_application_launcher_from_string_hint, |
626 | get_autopilot_proxy_object_for_process, |
627 | launch_application, |
628 | - ) |
629 | +) |
630 | from autopilot.display import Display |
631 | from autopilot.utilities import on_test_started |
632 | from autopilot.keybindings import KeybindingsHelper |
633 | from autopilot.matchers import Eventually |
634 | try: |
635 | from autopilot import tracepoint as tp |
636 | - HAVE_TRACEPOINT=True |
637 | + HAVE_TRACEPOINT = True |
638 | except ImportError: |
639 | - HAVE_TRACEPOINT=False |
640 | + HAVE_TRACEPOINT = False |
641 | |
642 | |
643 | logger = logging.getLogger(__name__) |
644 | @@ -85,6 +85,7 @@ |
645 | from testscenarios.scenarios import multiply_scenarios |
646 | except ImportError: |
647 | from itertools import product |
648 | + |
649 | def multiply_scenarios(*scenarios): |
650 | """Multiply two or more iterables of scenarios. |
651 | |
652 | @@ -110,7 +111,9 @@ |
653 | if HAVE_TRACEPOINT: |
654 | tp.emit_test_started(test_id) |
655 | else: |
656 | - logger.warning("No tracing available - install the python-autopilot-trace package!") |
657 | + logger.warning( |
658 | + "No tracing available - install the python-autopilot-trace " |
659 | + "package!") |
660 | |
661 | |
662 | def _lttng_trace_test_ended(test_id): |
663 | @@ -121,9 +124,10 @@ |
664 | class AutopilotTestCase(TestWithScenarios, TestCase, KeybindingsHelper): |
665 | """Wrapper around testtools.TestCase that adds significant functionality. |
666 | |
667 | - This class should be the base class for all autopilot test case classes. Not |
668 | - using this class as the base class disables several important convenience |
669 | - methods, and also prevents the use of the failed-test recording tools. |
670 | + This class should be the base class for all autopilot test case classes. |
671 | + Not using this class as the base class disables several important |
672 | + convenience methods, and also prevents the use of the failed-test |
673 | + recording tools. |
674 | |
675 | """ |
676 | |
677 | @@ -140,10 +144,13 @@ |
678 | self._display = None |
679 | |
680 | try: |
681 | - self._app_snapshot = self.process_manager.get_running_applications() |
682 | + self._app_snapshot = \ |
683 | + self.process_manager.get_running_applications() |
684 | self.addCleanup(self._compare_system_with_app_snapshot) |
685 | except RuntimeError: |
686 | - logger.warning("Process manager backend unavailable, application snapshot support disabled.") |
687 | + logger.warning( |
688 | + "Process manager backend unavailable, application snapshot " |
689 | + "support disabled.") |
690 | |
691 | @property |
692 | def process_manager(self): |
693 | @@ -170,39 +177,45 @@ |
694 | return self._display |
695 | |
696 | def launch_test_application(self, application, *arguments, **kwargs): |
697 | - """Launch ``application`` and return a proxy object for the application. |
698 | + """Launch ``application`` and return a proxy object for the |
699 | + application. |
700 | |
701 | Use this method to launch an application and start testing it. The |
702 | positional arguments are used as arguments to the application to lanch. |
703 | - Keyword arguments are used to control the manner in which the application |
704 | - is launched. |
705 | + Keyword arguments are used to control the manner in which the |
706 | + application is launched. |
707 | |
708 | This method is designed to be flexible enough to launch all supported |
709 | - types of applications. Autopilot can automatically determine how to enable |
710 | - introspection support for dynamically linked binary applications. For |
711 | - example, to launch a binary Gtk application, a test might start with:: |
712 | + types of applications. Autopilot can automatically determine how to |
713 | + enable introspection support for dynamically linked binary |
714 | + applications. For example, to launch a binary Gtk application, a test |
715 | + might start with:: |
716 | |
717 | app_proxy = self.launch_test_application('gedit') |
718 | |
719 | - Applications can be given command line arguments by supplying positional |
720 | - arguments to this method. For example, if we want to launch ``gedit`` |
721 | - with a certain document loaded, we might do this:: |
722 | + Applications can be given command line arguments by supplying |
723 | + positional arguments to this method. For example, if we want to launch |
724 | + ``gedit`` with a certain document loaded, we might do this:: |
725 | |
726 | - app_proxy = self.launch_test_application('gedit', '/tmp/test-document.txt') |
727 | + app_proxy = self.launch_test_application( |
728 | + 'gedit', '/tmp/test-document.txt') |
729 | |
730 | ... a Qt5 Qml application is launched in a similar fashion:: |
731 | |
732 | - app_proxy = self.launch_test_application('qmlscene', 'my_scene.qml') |
733 | + app_proxy = self.launch_test_application( |
734 | + 'qmlscene', 'my_scene.qml') |
735 | |
736 | If you wish to launch an application that is not a dynamically linked |
737 | - binary, you must specify the application type. For example, a Qt4 python |
738 | - application might be launched like this:: |
739 | + binary, you must specify the application type. For example, a Qt4 |
740 | + python application might be launched like this:: |
741 | |
742 | - app_proxy = self.launch_test_application('my_qt_app.py', app_type='qt') |
743 | + app_proxy = self.launch_test_application( |
744 | + 'my_qt_app.py', app_type='qt') |
745 | |
746 | Similarly, a python/Gtk application is launched like so:: |
747 | |
748 | - app_proxy = self.launch_test_application('my_gtk_app.py', app_type='gtk') |
749 | + app_proxy = self.launch_test_application( |
750 | + 'my_gtk_app.py', app_type='gtk') |
751 | |
752 | .. seealso:: |
753 | |
754 | @@ -212,20 +225,23 @@ |
755 | :param application: The application to launch. The application can be |
756 | specified as: |
757 | |
758 | - * A full, absolute path to an executable file. (``/usr/bin/gedit``) |
759 | - * A relative path to an executable file. (``./build/my_app``) |
760 | + * A full, absolute path to an executable file. |
761 | + (``/usr/bin/gedit``) |
762 | + * A relative path to an executable file. |
763 | + (``./build/my_app``) |
764 | * An app name, which will be searched for in $PATH (``my_app``) |
765 | |
766 | - :keyword app_type: If set, provides a hint to autopilot as to which kind |
767 | - of introspection to enable. This is needed when the application you |
768 | - wish to launch is *not* a dynamically linked binary. Valid values are |
769 | - 'gtk' or 'qt'. These strings are case insensitive. |
770 | - |
771 | - :keyword launch_dir: If set to a directory that exists the process will be |
772 | - launched from that directory. |
773 | - |
774 | - :keyword capture_output: If set to True (the default), the process output |
775 | - will be captured and attached to the test as test detail. |
776 | + :keyword app_type: If set, provides a hint to autopilot as to which |
777 | + kind of introspection to enable. This is needed when the |
778 | + application you wish to launch is *not* a dynamically linked |
779 | + binary. Valid values are 'gtk' or 'qt'. These strings are case |
780 | + insensitive. |
781 | + |
782 | + :keyword launch_dir: If set to a directory that exists the process |
783 | + will be launched from that directory. |
784 | + |
785 | + :keyword capture_output: If set to True (the default), the process |
786 | + output will be captured and attached to the test as test detail. |
787 | |
788 | :keyword emulator_base: If set, specifies the base class to be used for |
789 | all emulators for this loaded application. |
790 | @@ -235,7 +251,7 @@ |
791 | data is retrievable via this object. |
792 | |
793 | """ |
794 | - app_path = subprocess.check_output(['which',application]).strip() |
795 | + app_path = subprocess.check_output(['which', application]).strip() |
796 | # Get a launcher, tests can override this if they need: |
797 | launcher_hint = kwargs.pop('app_type', '') |
798 | launcher = None |
799 | @@ -247,9 +263,10 @@ |
800 | except RuntimeError: |
801 | pass |
802 | if launcher is None: |
803 | - raise RuntimeError("Autopilot could not determine the correct \ |
804 | -introspection type to use. You can specify one by overriding the \ |
805 | -AutopilotTestCase.pick_app_launcher method.") |
806 | + raise RuntimeError( |
807 | + "Autopilot could not determine the correct introspection type " |
808 | + "to use. You can specify one by overriding the " |
809 | + "AutopilotTestCase.pick_app_launcher method.") |
810 | emulator_base = kwargs.pop('emulator_base', None) |
811 | process = launch_application(launcher, app_path, *arguments, **kwargs) |
812 | self.addCleanup(self._kill_process_and_attach_logs, process) |
813 | @@ -258,8 +275,9 @@ |
814 | def _compare_system_with_app_snapshot(self): |
815 | """Compare the currently running application with the last snapshot. |
816 | |
817 | - This method will raise an AssertionError if there are any new applications |
818 | - currently running that were not running when the snapshot was taken. |
819 | + This method will raise an AssertionError if there are any new |
820 | + applications currently running that were not running when the snapshot |
821 | + was taken. |
822 | """ |
823 | if self._app_snapshot is None: |
824 | raise RuntimeError("No snapshot to match against.") |
825 | @@ -267,19 +285,22 @@ |
826 | new_apps = [] |
827 | for i in range(10): |
828 | current_apps = self.process_manager.get_running_applications() |
829 | - new_apps = filter(lambda i: i not in self._app_snapshot, current_apps) |
830 | + new_apps = filter( |
831 | + lambda i: i not in self._app_snapshot, current_apps) |
832 | if not new_apps: |
833 | self._app_snapshot = None |
834 | return |
835 | sleep(1) |
836 | self._app_snapshot = None |
837 | - raise AssertionError("The following apps were started during the test and not closed: %r", new_apps) |
838 | + raise AssertionError( |
839 | + "The following apps were started during the test and not closed: " |
840 | + "%r", new_apps) |
841 | |
842 | def patch_environment(self, key, value): |
843 | """Patch the process environment, setting *key* with value *value*. |
844 | |
845 | - This patches os.environ for the duration of the test only. After calling |
846 | - this method, the following should be True:: |
847 | + This patches os.environ for the duration of the test only. After |
848 | + calling this method, the following should be True:: |
849 | |
850 | os.environ[key] == value |
851 | |
852 | @@ -290,12 +311,12 @@ |
853 | affects the current autopilot process, and any processes spawned by |
854 | autopilot. If you are planing on starting an application from within |
855 | autopilot and you want this new application to read the patched |
856 | - environment variable, you must patch the environment *before* launching |
857 | - the new process. |
858 | + environment variable, you must patch the environment *before* |
859 | + launching the new process. |
860 | |
861 | - :param string key: The name of the key you wish to set. If the key does not |
862 | - already exist in the process environment it will be created (and then |
863 | - deleted when the test ends). |
864 | + :param string key: The name of the key you wish to set. If the key |
865 | + does not already exist in the process environment it will be created |
866 | + (and then deleted when the test ends). |
867 | :param string value: The value you wish to set. |
868 | |
869 | """ |
870 | @@ -307,7 +328,8 @@ |
871 | os.environ[key] = value |
872 | |
873 | def assertVisibleWindowStack(self, stack_start): |
874 | - """Check that the visible window stack starts with the windows passed in. |
875 | + """Check that the visible window stack starts with the windows passed |
876 | + in. |
877 | |
878 | .. note:: Minimised windows are skipped. |
879 | |
880 | @@ -317,13 +339,17 @@ |
881 | match the contents of the stack_start parameter. |
882 | |
883 | """ |
884 | - stack = [win for win in self.process_manager.get_open_windows() if not win.is_hidden] |
885 | + stack = [ |
886 | + win for win in |
887 | + self.process_manager.get_open_windows() if not win.is_hidden] |
888 | for pos, win in enumerate(stack_start): |
889 | - self.assertThat(stack[pos].x_id, Equals(win.x_id), |
890 | - "%r at %d does not equal %r" % (stack[pos], pos, win)) |
891 | + self.assertThat( |
892 | + stack[pos].x_id, Equals(win.x_id), |
893 | + "%r at %d does not equal %r" % (stack[pos], pos, win)) |
894 | |
895 | def assertProperty(self, obj, **kwargs): |
896 | - """Assert that *obj* has properties equal to the key/value pairs in kwargs. |
897 | + """Assert that *obj* has properties equal to the key/value pairs in |
898 | + kwargs. |
899 | |
900 | This method is intended to be used on objects whose attributes do not |
901 | have the :meth:`wait_for` method (i.e.- objects that do not come from |
902 | @@ -352,12 +378,16 @@ |
903 | none_val = object() |
904 | attr = getattr(obj, prop_name, none_val) |
905 | if attr == none_val: |
906 | - raise AssertionError("Object %r does not have an attribute named '%s'" |
907 | + raise AssertionError( |
908 | + "Object %r does not have an attribute named '%s'" |
909 | % (obj, prop_name)) |
910 | if callable(attr): |
911 | - raise ValueError("Object %r's '%s' attribute is a callable. It must be a property." |
912 | - % (obj, prop_name)) |
913 | - self.assertThat(lambda: getattr(obj, prop_name), Eventually(Equals(desired_value))) |
914 | + raise ValueError( |
915 | + "Object %r's '%s' attribute is a callable. It must be a " |
916 | + "property." % (obj, prop_name)) |
917 | + self.assertThat( |
918 | + lambda: getattr(obj, prop_name), |
919 | + Eventually(Equals(desired_value))) |
920 | |
921 | assertProperties = assertProperty |
922 | |
923 | @@ -385,7 +415,9 @@ |
924 | if process.returncode is not None: |
925 | break |
926 | if i == 9: |
927 | - logger.info("Killing process group, since it hasn't exited after 10 seconds.") |
928 | + logger.info( |
929 | + "Killing process group, since it hasn't exited after 10 " |
930 | + "seconds.") |
931 | os.killpg(process.pid, signal.SIGKILL) |
932 | sleep(1) |
933 | stdout, stderr = process.communicate() |
934 | |
935 | === modified file 'autopilot/testresult.py' |
936 | --- autopilot/testresult.py 2013-04-23 04:15:54 +0000 |
937 | +++ autopilot/testresult.py 2013-07-22 04:44:44 +0000 |
938 | @@ -27,7 +27,8 @@ |
939 | |
940 | |
941 | class AutopilotVerboseResult(object): |
942 | - """A result class that logs failures, errors and success via the python logging framework.""" |
943 | + """A result class that logs failures, errors and success via the python |
944 | + logging framework.""" |
945 | |
946 | def _log(self, level, message): |
947 | """Performs the actual message logging""" |
948 | |
949 | === modified file 'autopilot/utilities.py' |
950 | --- autopilot/utilities.py 2013-05-30 05:26:34 +0000 |
951 | +++ autopilot/utilities.py 2013-07-22 04:44:44 +0000 |
952 | @@ -35,10 +35,12 @@ |
953 | def _pick_backend(backends, preferred_backend): |
954 | """Pick a backend and return an instance of it.""" |
955 | possible_backends = backends.keys() |
956 | - get_debug_logger().debug("Possible backends: %s", ','.join(possible_backends)) |
957 | + get_debug_logger().debug( |
958 | + "Possible backends: %s", ','.join(possible_backends)) |
959 | if preferred_backend: |
960 | if preferred_backend in possible_backends: |
961 | - possible_backends.sort(lambda a,b: -1 if a == preferred_backend else 0) |
962 | + possible_backends.sort( |
963 | + lambda a, b: -1 if a == preferred_backend else 0) |
964 | else: |
965 | raise RuntimeError("Unknown backend '%s'" % (preferred_backend)) |
966 | failure_reasons = [] |
967 | @@ -50,10 +52,11 @@ |
968 | failure_reasons.append('%s: %r' % (be, e)) |
969 | if preferred_backend != '': |
970 | raise BackendException(e) |
971 | - raise RuntimeError("Unable to instantiate any backends\n%s" % '\n'.join(failure_reasons)) |
972 | - |
973 | - |
974 | -# Taken from http://code.activestate.com/recipes/577564-context-manager-for-low-level-redirection-of-stdou/ |
975 | + raise RuntimeError( |
976 | + "Unable to instantiate any backends\n%s" % '\n'.join(failure_reasons)) |
977 | + |
978 | + |
979 | +# Taken from http://ur1.ca/eqapv |
980 | # licensed under the MIT license. |
981 | class Silence(object): |
982 | """Context manager which uses low-level file descriptors to suppress |
983 | @@ -77,7 +80,8 @@ |
984 | self.fds = fds = [s.fileno() for s in saved_streams] |
985 | self.saved_fds = map(os.dup, fds) |
986 | # flush any pending output |
987 | - for s in saved_streams: s.flush() |
988 | + for s in saved_streams: |
989 | + s.flush() |
990 | |
991 | # open surrogate files |
992 | if self.combine: |
993 | @@ -85,7 +89,8 @@ |
994 | if self.outfiles[0] != os.devnull: |
995 | # disable buffering so output is merged immediately |
996 | sys.stdout, sys.stderr = map(os.fdopen, fds, ['w']*2, [0]*2) |
997 | - else: null_streams = [open(f, self.mode, 0) for f in self.outfiles] |
998 | + else: |
999 | + null_streams = [open(f, self.mode, 0) for f in self.outfiles] |
1000 | self.null_fds = null_fds = [s.fileno() for s in null_streams] |
1001 | self.null_streams = null_streams |
1002 | |
1003 | @@ -95,20 +100,24 @@ |
1004 | def __exit__(self, *args): |
1005 | sys = self.sys |
1006 | # flush any pending output |
1007 | - for s in self.saved_streams: s.flush() |
1008 | + for s in self.saved_streams: |
1009 | + s.flush() |
1010 | # restore original streams and file descriptors |
1011 | map(os.dup2, self.saved_fds, self.fds) |
1012 | sys.stdout, sys.stderr = self.saved_streams |
1013 | # clean up |
1014 | - for s in self.null_streams: s.close() |
1015 | - for fd in self.saved_fds: os.close(fd) |
1016 | + for s in self.null_streams: |
1017 | + s.close() |
1018 | + for fd in self.saved_fds: |
1019 | + os.close(fd) |
1020 | return False |
1021 | |
1022 | |
1023 | class LogFormatter(logging.Formatter): |
1024 | |
1025 | # this is the default format to use for logging |
1026 | - log_format = "%(asctime)s %(levelname)s %(module)s:%(lineno)d - %(message)s" |
1027 | + log_format = ( |
1028 | + "%(asctime)s %(levelname)s %(module)s:%(lineno)d - %(message)s") |
1029 | |
1030 | def __init__(self): |
1031 | super(LogFormatter, self).__init__(self.log_format) |
1032 | @@ -124,8 +133,8 @@ |
1033 | |
1034 | |
1035 | class Timer(object): |
1036 | - |
1037 | - """A context-manager that times a block of code, writing the results to the log.""" |
1038 | + """A context-manager that times a block of code, writing the results to |
1039 | + the log.""" |
1040 | |
1041 | def __init__(self, code_name, log_level=logging.DEBUG): |
1042 | self.code_name = code_name |
1043 | @@ -138,7 +147,9 @@ |
1044 | |
1045 | def __exit__(self, *args): |
1046 | self.end = time.time() |
1047 | - self.logger.log(self.log_level, "'%s' took %.3fS", self.code_name, self.end - self.start) |
1048 | + self.logger.log( |
1049 | + self.log_level, "'%s' took %.3fS", self.code_name, |
1050 | + self.end - self.start) |
1051 | |
1052 | |
1053 | def get_debug_logger(): |
1054 | @@ -167,10 +178,15 @@ |
1055 | @wraps(fn) |
1056 | def wrapped(*args, **kwargs): |
1057 | import sys |
1058 | - outerframe_details = inspect.getouterframes(inspect.currentframe())[1] |
1059 | + outerframe_details = inspect.getouterframes( |
1060 | + inspect.currentframe())[1] |
1061 | filename, line_number, function_name = outerframe_details[1:4] |
1062 | - sys.stderr.write("WARNING: in file \"{0}\", line {1} in {2}\n".format(filename, line_number, function_name)) |
1063 | - sys.stderr.write("This function is deprecated. Please use '%s' instead.\n" % alternative) |
1064 | + sys.stderr.write( |
1065 | + "WARNING: in file \"{0}\", line {1} in {2}\n".format( |
1066 | + filename, line_number, function_name)) |
1067 | + sys.stderr.write( |
1068 | + "This function is deprecated. Please use '%s' instead.\n" % |
1069 | + alternative) |
1070 | return fn(*args, **kwargs) |
1071 | return wrapped |
1072 | return fdec |
1073 | @@ -184,7 +200,9 @@ |
1074 | |
1075 | def __call__(self, callable, *args, **kwargs): |
1076 | if self._test_instance is None: |
1077 | - raise RuntimeError("Out-of-test addCleanup can only be called while an autopilot test case is running!") |
1078 | + raise RuntimeError( |
1079 | + "Out-of-test addCleanup can only be called while an autopilot " |
1080 | + "test case is running!") |
1081 | self._test_instance.addCleanup(callable, *args, **kwargs) |
1082 | |
1083 | def set_test_instance(self, test_instance): |
1084 | @@ -205,8 +223,8 @@ |
1085 | """Metaclass to inject the object into on test start/end functionality""" |
1086 | def __new__(cls, classname, bases, classdict): |
1087 | class EmptyStaticMethod(object): |
1088 | - """Class used to give us 'default classmethods' for those that don't |
1089 | - provide them. |
1090 | + """Class used to give us 'default classmethods' for those that |
1091 | + don't provide them. |
1092 | |
1093 | """ |
1094 | def __get__(self, obj, klass=None): |
1095 | @@ -232,6 +250,7 @@ |
1096 | |
1097 | |
1098 | class CleanupRegistered(object): |
1099 | + |
1100 | __metaclass__ = _TestCleanupMeta |
1101 | |
1102 |
PASSED: Continuous integration, rev:300 jenkins. qa.ubuntu. com/job/ autopilot- ci/166/ jenkins. qa.ubuntu. com/job/ autopilot- saucy-amd64- ci/94 jenkins. qa.ubuntu. com/job/ autopilot- saucy-armhf- ci/94
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ autopilot- ci/166/ rebuild
http://