Merge lp:~elopio/autopilot/fix1201057-pep8-5 into lp:autopilot

Proposed by Leo Arias
Status: Merged
Approved by: Thomi Richards
Approved revision: 295
Merged at revision: 271
Proposed branch: lp:~elopio/autopilot/fix1201057-pep8-5
Merge into: lp:autopilot
Prerequisite: lp:~elopio/autopilot/fix1201057-pep8-4
Diff against target: 1441 lines (+373/-230)
10 files modified
autopilot/tests/functional/test_ap_apps.py (+13/-10)
autopilot/tests/functional/test_application_mixin.py (+26/-13)
autopilot/tests/functional/test_autopilot_functional.py (+256/-164)
autopilot/tests/functional/test_custom_assertions.py (+33/-16)
autopilot/tests/functional/test_dbus_query.py (+2/-1)
autopilot/tests/functional/test_input_stack.py (+5/-2)
autopilot/tests/functional/test_introspection_features.py (+3/-4)
autopilot/tests/functional/test_mouse_emulator.py (+23/-13)
autopilot/tests/functional/test_open_window.py (+2/-1)
autopilot/tests/functional/test_process_emulator.py (+10/-6)
To merge this branch: bzr merge lp:~elopio/autopilot/fix1201057-pep8-5
Reviewer Review Type Date Requested Status
Thomi Richards (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+174604@code.launchpad.net

Commit message

Fixed pep8 errors in autopilot/functional.

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) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'autopilot/tests/functional/test_ap_apps.py'
2--- autopilot/tests/functional/test_ap_apps.py 2013-05-29 11:23:51 +0000
3+++ autopilot/tests/functional/test_ap_apps.py 2013-07-14 10:07:37 +0000
4@@ -56,7 +56,8 @@
5 introspection type to use. You can specify one by overriding the \
6 AutopilotTestCase.pick_app_launcher method."
7
8- self.assertThat(lambda: self.launch_test_application(path),
9+ self.assertThat(
10+ lambda: self.launch_test_application(path),
11 raises(RuntimeError(expected_error_message)))
12
13
14@@ -64,9 +65,10 @@
15
16 def _find_qt_binary_chooser(self, version, name):
17 # Check for existence of the binary when qtchooser is installed
18- # We cannot use 'which', as qtchooser installs wrappers - we need to check
19- # in the actual library paths
20- env = subprocess.check_output(['qtchooser', '-qt=' + version, '-print-env']).split('\n')
21+ # We cannot use 'which', as qtchooser installs wrappers - we need to
22+ # check in the actual library paths
23+ env = subprocess.check_output(
24+ ['qtchooser', '-qt=' + version, '-print-env']).split('\n')
25 for i in env:
26 if i.find('QTTOOLDIR') >= 0:
27 path = i.lstrip("QTTOOLDIR=").strip('"') + "/" + name
28@@ -78,21 +80,21 @@
29 def _find_qt_binary_old(self, version, name):
30 # Check for the existence of the binary the old way
31 try:
32- path = subprocess.check_output(['which','qmlviewer']).strip()
33+ path = subprocess.check_output(['which', 'qmlviewer']).strip()
34 except subprocess.CalledProcessError:
35 path = None
36 return path
37
38-
39 def setUp(self):
40 super(QtTests, self).setUp()
41
42 try:
43- qtversions = subprocess.check_output(['qtchooser', '-list-versions']).split('\n')
44+ qtversions = subprocess.check_output(
45+ ['qtchooser', '-list-versions']).split('\n')
46 check_func = self._find_qt_binary_chooser
47 except OSError:
48- # This means no qtchooser is installed, so let's check for qmlviewer
49- # and qmlscene manually, the old way
50+ # This means no qtchooser is installed, so let's check for
51+ # qmlviewer and qmlscene manually, the old way
52 qtversions = ['qt4', 'qt5']
53 check_func = self._find_qt_binary_old
54
55@@ -160,7 +162,8 @@
56 super(GtkTests, self).setUp()
57
58 try:
59- self.app_path = subprocess.check_output(['which','gnome-mahjongg']).strip()
60+ self.app_path = subprocess.check_output(
61+ ['which', 'gnome-mahjongg']).strip()
62 except subprocess.CalledProcessError:
63 self.skip("gnome-mahjongg not found.")
64
65
66=== modified file 'autopilot/tests/functional/test_application_mixin.py'
67--- autopilot/tests/functional/test_application_mixin.py 2013-05-16 06:12:58 +0000
68+++ autopilot/tests/functional/test_application_mixin.py 2013-07-14 10:07:37 +0000
69@@ -27,29 +27,42 @@
70 class ApplicationSupportTests(AutopilotTestCase):
71
72 def test_launch_with_bad_types_raises_typeerror(self):
73- """Calling launch_test_application with something other than a string must
74- raise a TypeError"""
75+ """Calling launch_test_application with something other than a string
76+ must raise a TypeError"""
77
78- self.assertThat(lambda: self.launch_test_application(1), raises(TypeError))
79- self.assertThat(lambda: self.launch_test_application(True), raises(TypeError))
80- self.assertThat(lambda: self.launch_test_application(1.0), raises(TypeError))
81- self.assertThat(lambda: self.launch_test_application(object()), raises(TypeError))
82- self.assertThat(lambda: self.launch_test_application(None), raises(TypeError))
83- self.assertThat(lambda: self.launch_test_application([]), raises(TypeError))
84- self.assertThat(lambda: self.launch_test_application((None,)), raises(TypeError))
85+ self.assertThat(
86+ lambda: self.launch_test_application(1), raises(TypeError))
87+ self.assertThat(
88+ lambda: self.launch_test_application(True), raises(TypeError))
89+ self.assertThat(
90+ lambda: self.launch_test_application(1.0), raises(TypeError))
91+ self.assertThat(
92+ lambda: self.launch_test_application(object()), raises(TypeError))
93+ self.assertThat(
94+ lambda: self.launch_test_application(None), raises(TypeError))
95+ self.assertThat(
96+ lambda: self.launch_test_application([]), raises(TypeError))
97+ self.assertThat(
98+ lambda: self.launch_test_application((None,)), raises(TypeError))
99
100 def test_launch_raises_ValueError_on_unknown_kwargs(self):
101 """launch_test_application must raise ValueError when given unknown
102 keyword arguments.
103
104 """
105- fn = lambda: self.launch_test_application('gedit', arg1=123, arg2='asd')
106- self.assertThat(fn, raises(ValueError("Unknown keyword arguments: 'arg1', 'arg2'.")))
107+ fn = lambda: self.launch_test_application(
108+ 'gedit', arg1=123, arg2='asd')
109+ self.assertThat(
110+ fn,
111+ raises(ValueError("Unknown keyword arguments: 'arg1', 'arg2'.")))
112
113 def test_launch_raises_ValueError_on_unknown_kwargs_with_known(self):
114 """launch_test_application must raise ValueError when given unknown
115 keyword arguments.
116
117 """
118- fn = lambda: self.launch_test_application('gedit', arg1=123, arg2='asd', launch_dir='/')
119- self.assertThat(fn, raises(ValueError("Unknown keyword arguments: 'arg1', 'arg2'.")))
120+ fn = lambda: self.launch_test_application(
121+ 'gedit', arg1=123, arg2='asd', launch_dir='/')
122+ self.assertThat(
123+ fn,
124+ raises(ValueError("Unknown keyword arguments: 'arg1', 'arg2'.")))
125
126=== modified file 'autopilot/tests/functional/test_autopilot_functional.py'
127--- autopilot/tests/functional/test_autopilot_functional.py 2013-07-09 11:29:06 +0000
128+++ autopilot/tests/functional/test_autopilot_functional.py 2013-07-14 10:07:37 +0000
129@@ -33,7 +33,6 @@
130 from textwrap import dedent
131 import re
132
133-
134 from autopilot.testcase import AutopilotTestCase
135
136
137@@ -47,6 +46,7 @@
138
139 logger = logging.getLogger(__name__)
140
141+
142 class AutopilotFunctionalTestsBase(AutopilotTestCase):
143
144 """The base class for the autopilot functional tests."""
145@@ -56,7 +56,8 @@
146 self.base_path = self.create_empty_test_module()
147
148 def create_empty_test_module(self):
149- """Create an empty temp directory, with an empty test directory inside it.
150+ """Create an empty temp directory, with an empty test directory inside
151+ it.
152
153 This method handles cleaning up the directory once the test completes.
154
155@@ -72,7 +73,7 @@
156 # create the tests directory:
157 os.mkdir(
158 os.path.join(base_path, 'tests')
159- )
160+ )
161
162 # make tests importable:
163 open(
164@@ -90,8 +91,8 @@
165 '..',
166 '..',
167 '..'
168- )
169 )
170+ )
171
172 environment_patch = dict(DISPLAY=':0')
173 if not os.getcwd().startswith('/usr/'):
174@@ -99,7 +100,8 @@
175 bin_path = os.path.join(ap_base_path, 'bin', 'autopilot')
176 if not os.path.exists(bin_path):
177 bin_path = subprocess.check_output(['which', 'autopilot']).strip()
178- logger.info("Not running from source, setting bin_path to %s", bin_path)
179+ logger.info(
180+ "Not running from source, setting bin_path to %s", bin_path)
181
182 environ = os.environ
183 environ.update(environment_patch)
184@@ -117,18 +119,20 @@
185 env=environ,
186 stdout=subprocess.PIPE,
187 stderr=subprocess.PIPE,
188- )
189+ )
190
191 stdout, stderr = process.communicate()
192 retcode = process.poll()
193
194 self.addDetail('retcode', text_content(str(retcode)))
195- self.addDetail('stdout', Content(
196- ContentType('text', 'plain', {'charset': 'iso-8859-1'}),
197- lambda:[stdout]))
198- self.addDetail('stderr', Content(
199- ContentType('text', 'plain', {'charset': 'iso-8859-1'}),
200- lambda:[stderr]))
201+ self.addDetail(
202+ 'stdout', Content(
203+ ContentType('text', 'plain', {'charset': 'iso-8859-1'}),
204+ lambda: [stdout]))
205+ self.addDetail(
206+ 'stderr', Content(
207+ ContentType('text', 'plain', {'charset': 'iso-8859-1'}),
208+ lambda: [stderr]))
209
210 return (retcode, stdout, stderr)
211
212@@ -155,8 +159,8 @@
213 def run_autopilot_list(self, list_spec='tests', extra_args=[]):
214 """Run 'autopilot list' in the specified base path.
215
216- This patches the environment to ensure that it's *this* version of autopilot
217- that's run.
218+ This patches the environment to ensure that it's *this* version of
219+ autopilot that's run.
220
221 returns a tuple containing: (exit_code, stdout, stderr)
222
223@@ -179,14 +183,15 @@
224
225 %d total %s.
226 ''' % (self.base_path,
227- ''.join([' %s\n' % t for t in sorted(tests)]),
228- len(tests),
229- total_title)
230+ ''.join([' %s\n' % t for t in sorted(tests)]),
231+ len(tests),
232+ total_title)
233
234 self.assertThat(output, Equals(expected))
235
236 def test_can_list_empty_test_dir(self):
237- """Autopilot list must report 0 tests found with an empty test module."""
238+ """Autopilot list must report 0 tests found with an empty test
239+ module."""
240 code, output, error = self.run_autopilot_list()
241
242 self.assertThat(code, Equals(0))
243@@ -195,7 +200,8 @@
244
245 def test_can_list_tests(self):
246 """Autopilot must find tests in a file."""
247- self.create_test_file('test_simple.py', dedent("""\
248+ self.create_test_file(
249+ 'test_simple.py', dedent("""\
250
251 from autopilot.testcase import AutopilotTestCase
252
253@@ -204,8 +210,8 @@
254
255 def test_simple(self):
256 pass
257- """
258- ))
259+ """)
260+ )
261
262 # ideally these would be different tests, but I'm lazy:
263 valid_test_specs = [
264@@ -213,15 +219,17 @@
265 'tests.test_simple',
266 'tests.test_simple.SimpleTest',
267 'tests.test_simple.SimpleTest.test_simple',
268- ]
269+ ]
270 for test_spec in valid_test_specs:
271 code, output, error = self.run_autopilot_list(test_spec)
272 self.assertThat(code, Equals(0))
273 self.assertThat(error, Equals(''))
274- self.assertTestsInOutput(['tests.test_simple.SimpleTest.test_simple'], output)
275+ self.assertTestsInOutput(
276+ ['tests.test_simple.SimpleTest.test_simple'], output)
277
278 def test_list_tests_with_import_error(self):
279- self.create_test_file('test_simple.py', dedent("""\
280+ self.create_test_file(
281+ 'test_simple.py', dedent("""\
282
283 from autopilot.testcase import AutopilotTestCase
284 # create an import error:
285@@ -231,8 +239,8 @@
286
287 def test_simple(self):
288 pass
289- """
290- ))
291+ """)
292+ )
293 code, output, error = self.run_autopilot_list()
294 expected_regex = '''\
295 Loading tests from: %s
296@@ -241,7 +249,8 @@
297 Traceback \(most recent call last\):
298 File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
299 module = self._get_module_from_name\(name\)
300- File "/usr/lib/python2.7/unittest/loader.py", line 230, in _get_module_from_name
301+ File "/usr/lib/python2.7/unittest/loader.py", line 230, in \
302+_get_module_from_name
303 __import__\(name\)
304 File "/tmp/\w*/tests/test_simple.py", line 4, in <module>
305 import asdjkhdfjgsdhfjhsd
306@@ -253,7 +262,8 @@
307 self.assertTrue(re.search(expected_regex, output, re.MULTILINE))
308
309 def test_list_tests_with_syntax_error(self):
310- self.create_test_file('test_simple.py', dedent("""\
311+ self.create_test_file(
312+ 'test_simple.py', dedent("""\
313
314 from autopilot.testcase import AutopilotTestCase
315 # create a syntax error:
316@@ -263,8 +273,8 @@
317
318 def test_simple(self):
319 pass
320- """
321- ))
322+ """)
323+ )
324 code, output, error = self.run_autopilot_list()
325 expected_regex = '''\
326 Loading tests from: %s
327@@ -273,7 +283,8 @@
328 Traceback \(most recent call last\):
329 File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
330 module = self._get_module_from_name\(name\)
331- File "/usr/lib/python2.7/unittest/loader.py", line 230, in _get_module_from_name
332+ File "/usr/lib/python2.7/unittest/loader.py", line 230, in \
333+_get_module_from_name
334 __import__\(name\)
335 File "/tmp/\w*/tests/test_simple.py", line 4
336 \.\.
337@@ -286,8 +297,10 @@
338 self.assertTrue(re.search(expected_regex, output, re.MULTILINE))
339
340 def test_can_list_scenariod_tests(self):
341- """Autopilot must show scenario counts next to tests that have scenarios."""
342- self.create_test_file('test_simple.py', dedent("""\
343+ """Autopilot must show scenario counts next to tests that have
344+ scenarios."""
345+ self.create_test_file(
346+ 'test_simple.py', dedent("""\
347
348 from autopilot.testcase import AutopilotTestCase
349
350@@ -300,8 +313,8 @@
351
352 def test_simple(self):
353 pass
354- """
355- ))
356+ """)
357+ )
358
359 expected_output = '''\
360 Loading tests from: %s
361@@ -318,12 +331,15 @@
362 self.assertThat(output, Equals(expected_output))
363
364 def test_can_list_scenariod_tests_with_multiple_scenarios(self):
365- """Autopilot must show scenario counts next to tests that have scenarios.
366+ """Autopilot must show scenario counts next to tests that have
367+ scenarios.
368
369- Tests multiple scenarios on a single test suite with multiple test cases.
370+ Tests multiple scenarios on a single test suite with multiple test
371+ cases.
372
373 """
374- self.create_test_file('test_simple.py', dedent("""\
375+ self.create_test_file(
376+ 'test_simple.py', dedent("""\
377
378 from autopilot.testcase import AutopilotTestCase
379
380@@ -340,8 +356,8 @@
381
382 def test_simple_two(self):
383 pass
384- """
385- ))
386+ """)
387+ )
388
389 expected_output = '''\
390 Loading tests from: %s
391@@ -360,7 +376,8 @@
392
393 def test_can_list_invalid_scenarios(self):
394 """Autopilot must ignore scenarios that are not lists."""
395- self.create_test_file('test_simple.py', dedent("""\
396+ self.create_test_file(
397+ 'test_simple.py', dedent("""\
398
399 from autopilot.testcase import AutopilotTestCase
400
401@@ -371,17 +388,19 @@
402
403 def test_simple(self):
404 pass
405- """
406- ))
407+ """)
408+ )
409
410 code, output, error = self.run_autopilot_list()
411 self.assertThat(code, Equals(0))
412 self.assertThat(error, Equals(''))
413- self.assertTestsInOutput(['tests.test_simple.SimpleTest.test_simple'], output)
414+ self.assertTestsInOutput(
415+ ['tests.test_simple.SimpleTest.test_simple'], output)
416
417 def test_can_list_just_suites(self):
418 """Must only list available suites, not the contained tests."""
419- self.create_test_file('test_simple_suites.py', dedent("""\
420+ self.create_test_file(
421+ 'test_simple_suites.py', dedent("""\
422
423 from autopilot.testcase import AutopilotTestCase
424
425@@ -398,23 +417,25 @@
426
427 def test_yet_another_simple(self):
428 pass
429- """
430- ))
431+ """)
432+ )
433
434 code, output, error = self.run_autopilot_list(extra_args=['--suites'])
435 self.assertThat(code, Equals(0))
436 self.assertThat(error, Equals(''))
437- self.assertTestsInOutput(['tests.test_simple_suites.SimpleTest',
438- 'tests.test_simple_suites.AnotherSimpleTest'],
439- output,
440- total_title='suites')
441+ self.assertTestsInOutput(
442+ ['tests.test_simple_suites.SimpleTest',
443+ 'tests.test_simple_suites.AnotherSimpleTest'],
444+ output, total_title='suites')
445
446 def test_record_flag_works(self):
447 """Must be able to record videos when the -r flag is present."""
448
449- # The sleep is to avoid the case where recordmydesktop does not create a
450- # file because it gets stopped before it's even started capturing anything.
451- self.create_test_file("test_simple.py", dedent("""\
452+ # The sleep is to avoid the case where recordmydesktop does not create
453+ # a file because it gets stopped before it's even started capturing
454+ # anything.
455+ self.create_test_file(
456+ "test_simple.py", dedent("""\
457
458 from autopilot.testcase import AutopilotTestCase
459 from time import sleep
460@@ -424,30 +445,34 @@
461 def test_simple(self):
462 sleep(1)
463 self.fail()
464- """
465- ))
466+ """)
467+ )
468
469 should_delete = not os.path.exists('/tmp/autopilot')
470 if should_delete:
471 self.addCleanup(remove_if_exists, "/tmp/autopilot")
472 else:
473- self.addCleanup(remove_if_exists,
474- '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv')
475+ self.addCleanup(
476+ remove_if_exists,
477+ '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv')
478
479 code, output, error = self.run_autopilot(["run", "-r", "tests"])
480
481 self.assertThat(code, Equals(1))
482 self.assertTrue(os.path.exists('/tmp/autopilot'))
483- self.assertTrue(os.path.exists('/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv'))
484+ self.assertTrue(os.path.exists(
485+ '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv'))
486 if should_delete:
487 self.addCleanup(remove_if_exists, "/tmp/autopilot")
488
489 def test_record_dir_option_and_record_works(self):
490 """Must be able to specify record directory flag and record."""
491
492- # The sleep is to avoid the case where recordmydesktop does not create a
493- # file because it gets stopped before it's even started capturing anything.
494- self.create_test_file("test_simple.py", dedent("""\
495+ # The sleep is to avoid the case where recordmydesktop does not create
496+ # a file because it gets stopped before it's even started capturing
497+ # anything.
498+ self.create_test_file(
499+ "test_simple.py", dedent("""\
500
501 from autopilot.testcase import AutopilotTestCase
502 from time import sleep
503@@ -458,8 +483,8 @@
504 def test_simple(self):
505 sleep(1)
506 self.fail()
507- """
508- ))
509+ """)
510+ )
511 video_dir = mktemp()
512 ap_dir = '/tmp/autopilot'
513 self.addCleanup(remove_if_exists, video_dir)
514@@ -468,22 +493,29 @@
515 if should_delete:
516 self.addCleanup(remove_if_exists, ap_dir)
517 else:
518- self.addCleanup(remove_if_exists,
519- '%s/tests.test_simple.SimpleTest.test_simple.ogv' % (ap_dir))
520+ self.addCleanup(
521+ remove_if_exists,
522+ '%s/tests.test_simple.SimpleTest.test_simple.ogv' % (ap_dir))
523
524- code, output, error = self.run_autopilot(["run", "-r", "-rd", video_dir, "tests"])
525+ code, output, error = self.run_autopilot(
526+ ["run", "-r", "-rd", video_dir, "tests"])
527
528 self.assertThat(code, Equals(1))
529 self.assertTrue(os.path.exists(video_dir))
530- self.assertTrue(os.path.exists('%s/tests.test_simple.SimpleTest.test_simple.ogv' % (video_dir)))
531- self.assertFalse(os.path.exists('%s/tests.test_simple.SimpleTest.test_simple.ogv' % (ap_dir)))
532+ self.assertTrue(os.path.exists(
533+ '%s/tests.test_simple.SimpleTest.test_simple.ogv' % (video_dir)))
534+ self.assertFalse(
535+ os.path.exists(
536+ '%s/tests.test_simple.SimpleTest.test_simple.ogv' % (ap_dir)))
537
538 def test_record_dir_option_works(self):
539 """Must be able to specify record directory flag."""
540
541- # The sleep is to avoid the case where recordmydesktop does not create a
542- # file because it gets stopped before it's even started capturing anything.
543- self.create_test_file("test_simple.py", dedent("""\
544+ # The sleep is to avoid the case where recordmydesktop does not create
545+ # a file because it gets stopped before it's even started capturing
546+ # anything.
547+ self.create_test_file(
548+ "test_simple.py", dedent("""\
549
550 from autopilot.testcase import AutopilotTestCase
551 from time import sleep
552@@ -494,20 +526,25 @@
553 def test_simple(self):
554 sleep(1)
555 self.fail()
556- """
557- ))
558+ """)
559+ )
560 video_dir = mktemp()
561 self.addCleanup(remove_if_exists, video_dir)
562
563- code, output, error = self.run_autopilot(["run", "-rd", video_dir, "tests"])
564+ code, output, error = self.run_autopilot(
565+ ["run", "-rd", video_dir, "tests"])
566
567 self.assertThat(code, Equals(1))
568 self.assertTrue(os.path.exists(video_dir))
569- self.assertTrue(os.path.exists('%s/tests.test_simple.SimpleTest.test_simple.ogv' % (video_dir)))
570+ self.assertTrue(
571+ os.path.exists(
572+ '%s/tests.test_simple.SimpleTest.test_simple.ogv' %
573+ (video_dir)))
574
575 def test_no_videos_saved_when_record_option_is_not_present(self):
576 """Videos must not be saved if the '-r' option is not specified."""
577- self.create_test_file("test_simple.py", dedent("""\
578+ self.create_test_file(
579+ "test_simple.py", dedent("""\
580
581 from autopilot.testcase import AutopilotTestCase
582 from time import sleep
583@@ -517,9 +554,10 @@
584 def test_simple(self):
585 sleep(1)
586 self.fail()
587- """
588- ))
589- self.addCleanup(remove_if_exists,
590+ """)
591+ )
592+ self.addCleanup(
593+ remove_if_exists,
594 '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv')
595
596 code, output, error = self.run_autopilot(["run", "tests"])
597@@ -533,7 +571,8 @@
598 failed).
599
600 """
601- self.create_test_file("test_simple.py", dedent("""\
602+ self.create_test_file(
603+ "test_simple.py", dedent("""\
604
605 from autopilot.testcase import AutopilotTestCase
606 from time import sleep
607@@ -543,10 +582,11 @@
608 def test_simple(self):
609 sleep(1)
610 self.skip("Skipping Test")
611- """
612- ))
613+ """)
614+ )
615
616- video_file_path = '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv'
617+ video_file_path = (
618+ '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv')
619 self.addCleanup(remove_if_exists, video_file_path)
620
621 code, output, error = self.run_autopilot(["run", "-r", "tests"])
622@@ -554,12 +594,13 @@
623 self.assertThat(code, Equals(0))
624 self.assertThat(os.path.exists(video_file_path), Equals(False))
625
626- def test_no_video_file_for_nested_testcase_when_parent_and_child_testcase_fail(self):
627+ def test_no_video_for_nested_testcase_when_parent_and_child_fail(self):
628 """Test recording must not create a new recording for nested testcases
629 where both the parent and the child testcase fail.
630
631 """
632- self.create_test_file("test_simple.py", dedent("""\
633+ self.create_test_file(
634+ "test_simple.py", dedent("""\
635
636 from autopilot.testcase import AutopilotTestCase
637 import os
638@@ -574,11 +615,15 @@
639
640 InnerTestCase("test_will_fail").run()
641 self.assertTrue(False)
642- """
643- ))
644+ """)
645+ )
646
647- expected_video_file = '/tmp/autopilot/tests.test_simple.OuterTestCase.test_nested_classes.ogv'
648- erroneous_video_file = '/tmp/autopilot/tests.test_simple.OuterTestCase.test_nested_classes.InnerTestCase.test_will_fail.ogv'
649+ expected_video_file = (
650+ '/tmp/autopilot/tests.test_simple.OuterTestCase.'
651+ 'test_nested_classes.ogv')
652+ erroneous_video_file = (
653+ '/tmp/autopilot/tests.test_simple.OuterTestCase.'
654+ 'test_nested_classes.InnerTestCase.test_will_fail.ogv')
655
656 self.addCleanup(remove_if_exists, expected_video_file)
657 self.addCleanup(remove_if_exists, erroneous_video_file)
658@@ -591,7 +636,8 @@
659
660 def test_runs_with_import_errors_fail(self):
661 """Import errors inside a test must be considered a test failure."""
662- self.create_test_file('test_simple.py', dedent("""\
663+ self.create_test_file(
664+ 'test_simple.py', dedent("""\
665
666 from autopilot.testcase import AutopilotTestCase
667 # create an import error:
668@@ -601,8 +647,8 @@
669
670 def test_simple(self):
671 pass
672- """
673- ))
674+ """)
675+ )
676
677 code, output, error = self.run_autopilot(["run", "tests"])
678
679@@ -613,7 +659,8 @@
680 Traceback \(most recent call last\):
681 File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
682 module = self._get_module_from_name\(name\)
683- File "/usr/lib/python2.7/unittest/loader.py", line 230, in _get_module_from_name
684+ File "/usr/lib/python2.7/unittest/loader.py", line 230, in \
685+_get_module_from_name
686 __import__\(name\)
687 File "/tmp/\w*/tests/test_simple.py", line 4, in <module>
688 import asdjkhdfjgsdhfjhsd
689@@ -628,7 +675,8 @@
690
691 def test_runs_with_syntax_errors_fail(self):
692 """Import errors inside a test must be considered a test failure."""
693- self.create_test_file('test_simple.py', dedent("""\
694+ self.create_test_file(
695+ 'test_simple.py', dedent("""\
696
697 from autopilot.testcase import AutopilotTestCase
698 # create a syntax error:
699@@ -638,8 +686,8 @@
700
701 def test_simple(self):
702 pass
703- """
704- ))
705+ """)
706+ )
707
708 code, output, error = self.run_autopilot(["run", "tests"])
709
710@@ -650,7 +698,8 @@
711 Traceback \(most recent call last\):
712 File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
713 module = self._get_module_from_name\(name\)
714- File "/usr/lib/python2.7/unittest/loader.py", line 230, in _get_module_from_name
715+ File "/usr/lib/python2.7/unittest/loader.py", line 230, in \
716+_get_module_from_name
717 __import__\(name\)
718 File "/tmp/\w*/tests/test_simple.py", line 4
719 \.\.
720@@ -665,8 +714,10 @@
721 self.assertThat(output, Contains("FAILED (failures=1)"))
722
723 def test_can_error_with_unicode_data(self):
724- """Tests that assert with unicode errors must get saved to a log file."""
725- self.create_test_file("test_simple.py", dedent(u"""\
726+ """Tests that assert with unicode errors must get saved to a log
727+ file."""
728+ self.create_test_file(
729+ "test_simple.py", dedent(u"""\
730 # encoding: utf-8
731
732 # from autopilot.testcase import AutopilotTestCase
733@@ -675,24 +726,30 @@
734 class SimpleTest(TestCase):
735
736 def test_simple(self):
737- self.fail(u'\xa1pl\u0279oM \u01ddpo\u0254\u0131u\u2229 oll\u01ddH')
738+ self.fail(
739+ u'\xa1pl\u0279oM \u01ddpo\u0254\u0131u\u2229 oll'
740+ u'\u01ddH')
741
742- """
743- ))
744+ """)
745+ )
746 output_file_path = mktemp()
747 self.addCleanup(remove_if_exists, output_file_path)
748
749- code, output, error = self.run_autopilot(["run", "-o", output_file_path, "tests"])
750+ code, output, error = self.run_autopilot(
751+ ["run", "-o", output_file_path, "tests"])
752
753 self.assertThat(code, Equals(1))
754 self.assertTrue(os.path.exists(output_file_path))
755 log_contents = unicode(open(output_file_path, encoding='utf-8').read())
756- self.assertThat(log_contents,
757+ self.assertThat(
758+ log_contents,
759 Contains(u'\xa1pl\u0279oM \u01ddpo\u0254\u0131u\u2229 oll\u01ddH'))
760
761 def test_can_write_xml_error_with_unicode_data(self):
762- """Tests that assert with unicode errors must get saved to XML log file."""
763- self.create_test_file("test_simple.py", dedent(u"""\
764+ """Tests that assert with unicode errors must get saved to XML log
765+ file."""
766+ self.create_test_file(
767+ "test_simple.py", dedent(u"""\
768 # encoding: utf-8
769
770 # from autopilot.testcase import AutopilotTestCase
771@@ -701,10 +758,12 @@
772 class SimpleTest(TestCase):
773
774 def test_simple(self):
775- self.fail(u'\xa1pl\u0279oM \u01ddpo\u0254\u0131u\u2229 oll\u01ddH')
776+ error = (u'\xa1pl\u0279oM \u01ddpo\u0254\u0131u'
777+ u'\u2229 oll\u01ddH')
778+ self.fail(error)
779
780- """
781- ))
782+ """)
783+ )
784 output_file_path = mktemp()
785 self.addCleanup(remove_if_exists, output_file_path)
786
787@@ -717,45 +776,58 @@
788 self.assertThat(code, Equals(1))
789 self.assertTrue(os.path.exists(output_file_path))
790 log_contents = unicode(open(output_file_path, encoding='utf-8').read())
791- self.assertThat(log_contents,
792+ self.assertThat(
793+ log_contents,
794 Contains(u'\xa1pl\u0279oM \u01ddpo\u0254\u0131u\u2229 oll\u01ddH'))
795
796 def test_launch_needs_arguments(self):
797- """Autopilot launch must complain if not given an application to launch."""
798+ """Autopilot launch must complain if not given an application to
799+ launch."""
800 rc, _, _ = self.run_autopilot(["launch"])
801 self.assertThat(rc, Equals(2))
802
803 def test_complains_on_unknown_introspection_type(self):
804- """Launching a binary that does not support an introspection type we are
805- familiar with must result in a nice error message.
806+ """Launching a binary that does not support an introspection type we
807+ are familiar with must result in a nice error message.
808
809 """
810 rc, stdout, _ = self.run_autopilot(["launch", "yes"])
811
812 self.assertThat(rc, Equals(1))
813- self.assertThat(stdout,
814- Contains("Error: Could not determine introspection type to use for application '/usr/bin/yes'"))
815+ self.assertThat(
816+ stdout,
817+ Contains(
818+ "Error: Could not determine introspection type to use for "
819+ "application '/usr/bin/yes'"))
820
821 def test_complains_on_missing_file(self):
822- """Must give a nice error message if we try and launch a binary that's missing."""
823+ """Must give a nice error message if we try and launch a binary that's
824+ missing."""
825 rc, stdout, _ = self.run_autopilot(["launch", "DoEsNotExist"])
826
827 self.assertThat(rc, Equals(1))
828- self.assertThat(stdout,
829- Contains("Error: cannot find application 'DoEsNotExist'"))
830+ self.assertThat(
831+ stdout, Contains("Error: cannot find application 'DoEsNotExist'"))
832
833 def test_complains_on_non_dynamic_binary(self):
834- """Must give a nice error message when passing in a non-dynamic binary."""
835- #tzselect is a bash script, and is in the base system, so should always exist.
836+ """Must give a nice error message when passing in a non-dynamic
837+ binary."""
838+ # tzselect is a bash script, and is in the base system, so should
839+ # always exist.
840 rc, stdout, _ = self.run_autopilot(["launch", "tzselect"])
841
842 self.assertThat(rc, Equals(1))
843- self.assertThat(stdout,
844- Contains("Error detecting launcher: Command '['ldd', '/usr/bin/tzselect']' returned non-zero exit status 1\n(Perhaps use the '-i' argument to specify an interface.)\n"))
845+ self.assertThat(
846+ stdout, Contains(
847+ "Error detecting launcher: Command '['ldd', "
848+ "'/usr/bin/tzselect']' returned non-zero exit status 1\n"
849+ "(Perhaps use the '-i' argument to specify an interface.)\n")
850+ )
851
852 def test_run_random_order_flag_works(self):
853 """Must run tests in random order when -ro is used"""
854- self.create_test_file("test_simple.py", dedent("""\
855+ self.create_test_file(
856+ "test_simple.py", dedent("""\
857
858 from autopilot.testcase import AutopilotTestCase
859 from time import sleep
860@@ -766,9 +838,8 @@
861 pass
862 def test_simple_two(self):
863 pass
864- """
865- ))
866-
867+ """)
868+ )
869
870 code, output, error = self.run_autopilot(["run", "-ro", "tests"])
871
872@@ -777,7 +848,8 @@
873
874 def test_run_random_flag_not_used(self):
875 """Must not run tests in random order when -ro is not used"""
876- self.create_test_file("test_simple.py", dedent("""\
877+ self.create_test_file(
878+ "test_simple.py", dedent("""\
879
880 from autopilot.testcase import AutopilotTestCase
881 from time import sleep
882@@ -788,9 +860,8 @@
883 pass
884 def test_simple_two(self):
885 pass
886- """
887- ))
888-
889+ """)
890+ )
891
892 code, output, error = self.run_autopilot(["run", "tests"])
893
894@@ -798,7 +869,6 @@
895 self.assertThat(output, Not(Contains('Running tests in random order')))
896
897
898-
899 class AutopilotVerboseFunctionalTests(AutopilotFunctionalTestsBase):
900
901 """Scenarioed functional tests for autopilot's verbose logging."""
902@@ -810,7 +880,8 @@
903
904 def test_verbose_flag_works(self):
905 """Verbose flag must log to stderr."""
906- self.create_test_file("test_simple.py", dedent("""\
907+ self.create_test_file(
908+ "test_simple.py", dedent("""\
909
910 from autopilot.testcase import AutopilotTestCase
911
912@@ -819,19 +890,22 @@
913
914 def test_simple(self):
915 pass
916- """
917- ))
918+ """)
919+ )
920
921 code, output, error = self.run_autopilot(["run",
922 "-f", self.output_format,
923 "-v", "tests"])
924
925 self.assertThat(code, Equals(0))
926- self.assertThat(error, Contains("Starting test tests.test_simple.SimpleTest.test_simple"))
927+ self.assertThat(
928+ error, Contains(
929+ "Starting test tests.test_simple.SimpleTest.test_simple"))
930
931 def test_verbose_flag_shows_timestamps(self):
932 """Verbose log must include timestamps."""
933- self.create_test_file("test_simple.py", dedent("""\
934+ self.create_test_file(
935+ "test_simple.py", dedent("""\
936
937 from autopilot.testcase import AutopilotTestCase
938
939@@ -840,8 +914,8 @@
940
941 def test_simple(self):
942 pass
943- """
944- ))
945+ """)
946+ )
947
948 code, output, error = self.run_autopilot(["run",
949 "-f", self.output_format,
950@@ -851,7 +925,8 @@
951
952 def test_verbose_flag_shows_success(self):
953 """Verbose log must indicate successful tests (text format)."""
954- self.create_test_file("test_simple.py", dedent("""\
955+ self.create_test_file(
956+ "test_simple.py", dedent("""\
957
958 from autopilot.testcase import AutopilotTestCase
959
960@@ -860,18 +935,20 @@
961
962 def test_simple(self):
963 pass
964- """
965- ))
966+ """)
967+ )
968
969 code, output, error = self.run_autopilot(["run",
970 "-f", self.output_format,
971 "-v", "tests"])
972
973- self.assertThat(error, Contains("OK: tests.test_simple.SimpleTest.test_simple"))
974+ self.assertThat(
975+ error, Contains("OK: tests.test_simple.SimpleTest.test_simple"))
976
977 def test_verbose_flag_shows_error(self):
978 """Verbose log must indicate test error with a traceback."""
979- self.create_test_file("test_simple.py", dedent("""\
980+ self.create_test_file(
981+ "test_simple.py", dedent("""\
982
983 from autopilot.testcase import AutopilotTestCase
984
985@@ -880,20 +957,25 @@
986
987 def test_simple(self):
988 self.assertTrue()
989- """
990- ))
991+ """)
992+ )
993
994 code, output, error = self.run_autopilot(["run",
995 "-f", self.output_format,
996 "-v", "tests"])
997
998- self.assertThat(error, Contains("ERROR: tests.test_simple.SimpleTest.test_simple"))
999+ self.assertThat(
1000+ error, Contains("ERROR: tests.test_simple.SimpleTest.test_simple"))
1001 self.assertThat(error, Contains("traceback:"))
1002- self.assertThat(error, Contains("TypeError: assertTrue() takes at least 2 arguments (1 given)"))
1003+ self.assertThat(
1004+ error, Contains("TypeError: assertTrue() takes at least 2 "
1005+ "arguments (1 given)"))
1006
1007 def test_verbose_flag_shows_failure(self):
1008- """Verbose log must indicate a test failure with a traceback (xml format)."""
1009- self.create_test_file("test_simple.py", dedent("""\
1010+ """Verbose log must indicate a test failure with a traceback (xml
1011+ format)."""
1012+ self.create_test_file(
1013+ "test_simple.py", dedent("""\
1014
1015 from autopilot.testcase import AutopilotTestCase
1016
1017@@ -902,8 +984,8 @@
1018
1019 def test_simple(self):
1020 self.assertTrue(False)
1021- """
1022- ))
1023+ """)
1024+ )
1025
1026 code, output, error = self.run_autopilot(["run",
1027 "-f", self.output_format,
1028@@ -914,8 +996,10 @@
1029 self.assertIn("AssertionError: False is not true", error)
1030
1031 def test_verbose_flag_captures_nested_autopilottestcase_classes(self):
1032- """Verbose log must contain the log details of both the nested and parent testcase."""
1033- self.create_test_file("test_simple.py", dedent("""\
1034+ """Verbose log must contain the log details of both the nested and
1035+ parent testcase."""
1036+ self.create_test_file(
1037+ "test_simple.py", dedent("""\
1038
1039 from autopilot.testcase import AutopilotTestCase
1040 import os
1041@@ -930,20 +1014,27 @@
1042
1043 InnerTestCase("test_produce_log_output").run()
1044 self.assertTrue(True)
1045- """
1046- ))
1047+ """)
1048+ )
1049
1050 code, output, error = self.run_autopilot(["run",
1051 "-f", self.output_format,
1052 "-v", "tests"])
1053
1054 self.assertThat(code, Equals(0))
1055- self.assertThat(error, Contains("Starting test tests.test_simple.OuterTestCase.test_nested_classes"))
1056- self.assertThat(error, Contains("Starting test tests.test_simple.InnerTestCase.test_produce_log_output"))
1057+ self.assertThat(
1058+ error, Contains(
1059+ "Starting test tests.test_simple.OuterTestCase."
1060+ "test_nested_classes"))
1061+ self.assertThat(
1062+ error, Contains(
1063+ "Starting test tests.test_simple.InnerTestCase."
1064+ "test_produce_log_output"))
1065
1066 def test_can_enable_debug_output(self):
1067 """Verbose log must show debug messages if we specify '-vv'."""
1068- self.create_test_file("test_simple.py", dedent("""\
1069+ self.create_test_file(
1070+ "test_simple.py", dedent("""\
1071
1072 from autopilot.testcase import AutopilotTestCase
1073 from autopilot.utilities import get_debug_logger
1074@@ -953,8 +1044,8 @@
1075
1076 def test_simple(self):
1077 get_debug_logger().debug("Hello World")
1078- """
1079- ))
1080+ """)
1081+ )
1082
1083 code, output, error = self.run_autopilot(["run",
1084 "-f", self.output_format,
1085@@ -964,7 +1055,8 @@
1086
1087 def test_debug_output_not_shown_by_default(self):
1088 """Verbose log must not show debug messages unless we specify '-vv'."""
1089- self.create_test_file("test_simple.py", dedent("""\
1090+ self.create_test_file(
1091+ "test_simple.py", dedent("""\
1092
1093 from autopilot.testcase import AutopilotTestCase
1094 from autopilot.utilities import get_debug_logger
1095@@ -974,8 +1066,8 @@
1096
1097 def test_simple(self):
1098 get_debug_logger().debug("Hello World")
1099- """
1100- ))
1101+ """)
1102+ )
1103
1104 code, output, error = self.run_autopilot(["run",
1105 "-f", self.output_format,
1106
1107=== modified file 'autopilot/tests/functional/test_custom_assertions.py'
1108--- autopilot/tests/functional/test_custom_assertions.py 2013-05-16 06:12:58 +0000
1109+++ autopilot/tests/functional/test_custom_assertions.py 2013-07-14 10:07:37 +0000
1110@@ -44,9 +44,11 @@
1111 test_object = TestObject()
1112
1113 def test_assertProperty_raises_valueerror_on_empty_test(self):
1114- """assertProperty must raise ValueError if called without any kwargs."""
1115+ """assertProperty must raise ValueError if called without any
1116+ kwargs."""
1117
1118- self.assertThat(lambda: self.assertProperty(self.test_object), raises(ValueError))
1119+ self.assertThat(
1120+ lambda: self.assertProperty(self.test_object), raises(ValueError))
1121
1122 def test_assertProperty_raises_valueerror_on_callable(self):
1123 """assertProperty must raise ValueError when called with a callable
1124@@ -54,15 +56,17 @@
1125
1126 """
1127
1128- self.assertThat(lambda: self.assertProperty(self.test_object, test_method=456),
1129+ self.assertThat(
1130+ lambda: self.assertProperty(self.test_object, test_method=456),
1131 raises(ValueError))
1132
1133 def test_assertProperty_raises_assert_with_single_property(self):
1134- """assertProperty must raise an AssertionError when called with a single
1135- property.
1136+ """assertProperty must raise an AssertionError when called with a
1137+ single property.
1138
1139 """
1140- self.assertThat(lambda: self.assertProperty(self.test_object, test_property=234),
1141+ self.assertThat(
1142+ lambda: self.assertProperty(self.test_object, test_property=234),
1143 raises(AssertionError))
1144
1145 def test_assertProperty_doesnt_raise(self):
1146@@ -71,7 +75,8 @@
1147
1148 """
1149
1150- self.assertThat(lambda: self.assertProperty(self.test_object, test_property=123),
1151+ self.assertThat(
1152+ lambda: self.assertProperty(self.test_object, test_property=123),
1153 Not(raises(AssertionError)))
1154
1155 def test_assertProperty_doesnt_raise_multiples(self):
1156@@ -80,29 +85,41 @@
1157
1158 """
1159
1160- self.assertThat(lambda: self.assertProperty(self.test_object, test_property=123, another_property="foobar"),
1161+ self.assertThat(
1162+ lambda: self.assertProperty(
1163+ self.test_object, test_property=123,
1164+ another_property="foobar"),
1165 Not(raises(AssertionError)))
1166
1167 def test_assertProperty_raises_assert_with_double_properties(self):
1168- """assertProperty must raise an AssertionError when called with multiple
1169- properties.
1170+ """assertProperty must raise an AssertionError when called with
1171+ multiple properties.
1172
1173 """
1174- self.assertThat(lambda: self.assertProperty(self.test_object, test_property=234, another_property=123),
1175+ self.assertThat(
1176+ lambda: self.assertProperty(
1177+ self.test_object, test_property=234, another_property=123),
1178 raises(AssertionError))
1179
1180 def test_assertProperties_works(self):
1181- """Asserts that the assertProperties method is a synonym for assertProperty."""
1182+ """Asserts that the assertProperties method is a synonym for
1183+ assertProperty."""
1184 self.assertThat(callable(self.assertProperties), Equals(True))
1185- self.assertThat(lambda: self.assertProperties(self.test_object, test_property=123, another_property="foobar"),
1186+ self.assertThat(
1187+ lambda: self.assertProperties(
1188+ self.test_object, test_property=123,
1189+ another_property="foobar"),
1190 Not(raises(AssertionError)))
1191
1192 def test_assertProperty_raises_assertionerror_on_no_such_property(self):
1193- """AssertProperty must rise an AssertionError if the property is not found."""
1194- self.assertThat(lambda: self.assertProperty(self.test_object, foo="bar"),
1195+ """AssertProperty must rise an AssertionError if the property is not
1196+ found."""
1197+ self.assertThat(
1198+ lambda: self.assertProperty(self.test_object, foo="bar"),
1199 raises(AssertionError))
1200
1201 def test_assertProperty_works_for_None_properties(self):
1202 """Must be able to match properties whose values are None."""
1203- self.assertThat(lambda: self.assertProperties(self.test_object, none_prop=None),
1204+ self.assertThat(
1205+ lambda: self.assertProperties(self.test_object, none_prop=None),
1206 Not(raises(AssertionError)))
1207
1208=== modified file 'autopilot/tests/functional/test_dbus_query.py'
1209--- autopilot/tests/functional/test_dbus_query.py 2013-05-05 02:39:14 +0000
1210+++ autopilot/tests/functional/test_dbus_query.py 2013-07-14 10:07:37 +0000
1211@@ -62,7 +62,8 @@
1212 json.dump(window_spec, open(file_path, 'w'))
1213 self.addCleanup(os.remove, file_path)
1214
1215- return self.launch_test_application('window-mocker', file_path, app_type="qt")
1216+ return self.launch_test_application(
1217+ 'window-mocker', file_path, app_type="qt")
1218
1219 def test_select_single_selects_only_available_object(self):
1220 """Must be able to select a single unique object."""
1221
1222=== modified file 'autopilot/tests/functional/test_input_stack.py'
1223--- autopilot/tests/functional/test_input_stack.py 2013-07-05 04:02:23 +0000
1224+++ autopilot/tests/functional/test_input_stack.py 2013-07-14 10:07:37 +0000
1225@@ -191,10 +191,12 @@
1226
1227 self.assertThat(FakeKeyboard.cleanup_called, Equals(True))
1228
1229+
1230 class InputStackCleanup(AutopilotTestCase):
1231
1232 def test_keyboard_keys_released_X11(self):
1233- """Cleanup must release any keys that an X11 keyboard has had pressed."""
1234+ """Cleanup must release any keys that an X11 keyboard has had
1235+ pressed."""
1236 class FakeTestCase(AutopilotTestCase):
1237 def test_press_key(self):
1238 kb = Keyboard.create('X11')
1239@@ -207,7 +209,8 @@
1240 self.assertThat(_PRESSED_KEYS, Equals([]))
1241
1242 def test_keyboard_keys_released_UInput(self):
1243- """Cleanup must release any keys that an UInput keyboard has had pressed."""
1244+ """Cleanup must release any keys that an UInput keyboard has had
1245+ pressed."""
1246 class FakeTestCase(AutopilotTestCase):
1247 def test_press_key(self):
1248 kb = Keyboard.create('UInput')
1249
1250=== modified file 'autopilot/tests/functional/test_introspection_features.py'
1251--- autopilot/tests/functional/test_introspection_features.py 2013-07-10 01:07:57 +0000
1252+++ autopilot/tests/functional/test_introspection_features.py 2013-07-14 10:07:37 +0000
1253@@ -39,11 +39,11 @@
1254
1255 def start_mock_app(self, emulator_base):
1256 window_spec_file = mktemp(suffix='.json')
1257- window_spec = { "Contents": "MouseTest" }
1258+ window_spec = {"Contents": "MouseTest"}
1259 json.dump(
1260 window_spec,
1261 open(window_spec_file, 'w')
1262- )
1263+ )
1264 self.addCleanup(os.remove, window_spec_file)
1265
1266 return self.launch_test_application(
1267@@ -51,7 +51,7 @@
1268 window_spec_file,
1269 app_type='qt',
1270 emulator_base=emulator_base,
1271- )
1272+ )
1273
1274 def test_can_select_custom_emulators_by_name(self):
1275 """Must be able to select a custom emulator type by name."""
1276@@ -122,4 +122,3 @@
1277 self.assertThat(result1.wasSuccessful(), Equals(True))
1278 result2 = InnerTestCase('test_custom_emulator').run()
1279 self.assertThat(result2.wasSuccessful(), Equals(True))
1280-
1281
1282=== modified file 'autopilot/tests/functional/test_mouse_emulator.py'
1283--- autopilot/tests/functional/test_mouse_emulator.py 2013-06-05 17:03:20 +0000
1284+++ autopilot/tests/functional/test_mouse_emulator.py 2013-07-14 10:07:37 +0000
1285@@ -24,20 +24,23 @@
1286
1287 from autopilot.input import Pointer, Mouse
1288
1289+
1290 class Empty(object):
1291 pass
1292
1293+
1294 def make_fake_object(globalRect=False, center=False, xywh=False):
1295 obj = Empty()
1296 if globalRect:
1297- obj.globalRect = (0,0,100,100)
1298+ obj.globalRect = (0, 0, 100, 100)
1299 if center:
1300 obj.center_x = 123
1301 obj.center_y = 345
1302 if xywh:
1303- obj.x, obj.y, obj.w, obj.h = (100,100,20,40)
1304+ obj.x, obj.y, obj.w, obj.h = (100, 100, 20, 40)
1305 return obj
1306
1307+
1308 class MouseEmulatorTests(TestCase):
1309 """Tests for the autopilot mouse emulator."""
1310
1311@@ -50,8 +53,10 @@
1312 self.mouse = None
1313
1314 def test_x_y_properties(self):
1315- """x and y properties must simply return values from the position() method."""
1316- with patch.object(self.mouse._device, 'position', return_value=(42,37)):
1317+ """x and y properties must simply return values from the position()
1318+ method."""
1319+ with patch.object(
1320+ self.mouse._device, 'position', return_value=(42, 37)):
1321 self.assertThat(self.mouse.x, Equals(42))
1322 self.assertThat(self.mouse.y, Equals(37))
1323
1324@@ -59,40 +64,45 @@
1325 """Passing an empty object to move_to_object must raise ValueError."""
1326 obj = make_fake_object()
1327 fn = lambda: self.mouse.move_to_object(obj)
1328- expected_exception = ValueError("Object '%r' does not have any recognised position attributes" % obj)
1329+ expected_exception = ValueError(
1330+ "Object '%r' does not have any recognised position attributes" %
1331+ obj)
1332 self.assertThat(fn, raises(expected_exception))
1333
1334 def test_move_to_object_works_with_globalRect_only(self):
1335- """move_to_object must move to the coordinates set in globalRect attribute."""
1336+ """move_to_object must move to the coordinates set in globalRect
1337+ attribute."""
1338 obj = make_fake_object(globalRect=True)
1339 with patch.object(self.mouse, 'move') as move_patch:
1340 self.mouse.move_to_object(obj)
1341- move_patch.assert_called_once_with(50,50)
1342+ move_patch.assert_called_once_with(50, 50)
1343
1344 def test_move_to_object_works_with_center_only(self):
1345- """move_to_object must move to the coordinates set in the center_x, center_y attributes."""
1346+ """move_to_object must move to the coordinates set in the center_x,
1347+ center_y attributes."""
1348 obj = make_fake_object(center=True)
1349 with patch.object(self.mouse, 'move') as move_patch:
1350 self.mouse.move_to_object(obj)
1351- move_patch.assert_called_once_with(123,345)
1352+ move_patch.assert_called_once_with(123, 345)
1353
1354 def test_move_to_object_works_with_x_y_w_h_only(self):
1355- """move_to_object must move to the coordinates set in the x, y, w & h attributes."""
1356+ """move_to_object must move to the coordinates set in the x, y, w & h
1357+ attributes."""
1358 obj = make_fake_object(xywh=True)
1359 with patch.object(self.mouse, 'move') as move_patch:
1360 self.mouse.move_to_object(obj)
1361- move_patch.assert_called_once_with(110,120)
1362+ move_patch.assert_called_once_with(110, 120)
1363
1364 def test_move_to_object_prefers_globalRect(self):
1365 """move_to_object must prefer globalRect over the other attributes."""
1366 obj = make_fake_object(globalRect=True, center=True, xywh=True)
1367 with patch.object(self.mouse, 'move') as move_patch:
1368 self.mouse.move_to_object(obj)
1369- move_patch.assert_called_once_with(50,50)
1370+ move_patch.assert_called_once_with(50, 50)
1371
1372 def test_move_to_object_prefers_center(self):
1373 """move_to_object must prefer center_[xy] to the xywh attributes."""
1374 obj = make_fake_object(globalRect=False, center=True, xywh=True)
1375 with patch.object(self.mouse, 'move') as move_patch:
1376 self.mouse.move_to_object(obj)
1377- move_patch.assert_called_once_with(123,345)
1378+ move_patch.assert_called_once_with(123, 345)
1379
1380=== modified file 'autopilot/tests/functional/test_open_window.py'
1381--- autopilot/tests/functional/test_open_window.py 2013-05-05 02:39:14 +0000
1382+++ autopilot/tests/functional/test_open_window.py 2013-07-14 10:07:37 +0000
1383@@ -30,7 +30,8 @@
1384
1385 class OpenWindowTests(AutopilotTestCase):
1386
1387- scenarios = [(k, {'app_name': k}) for k in ProcessManager.KNOWN_APPS.iterkeys()]
1388+ scenarios = [
1389+ (k, {'app_name': k}) for k in ProcessManager.KNOWN_APPS.iterkeys()]
1390
1391 def test_open_window(self):
1392 """self.start_app_window must open a new window of the given app."""
1393
1394=== modified file 'autopilot/tests/functional/test_process_emulator.py'
1395--- autopilot/tests/functional/test_process_emulator.py 2013-07-10 02:02:33 +0000
1396+++ autopilot/tests/functional/test_process_emulator.py 2013-07-14 10:07:37 +0000
1397@@ -34,9 +34,11 @@
1398
1399 def ensure_gedit_not_running(self):
1400 """Close any open gedit applications."""
1401- apps = self.process_manager.get_running_applications_by_desktop_file('gedit.desktop')
1402+ apps = self.process_manager.get_running_applications_by_desktop_file(
1403+ 'gedit.desktop')
1404 if apps:
1405- # this is a bit brutal, but easier in this context than the alternative.
1406+ # this is a bit brutal, but easier in this context than the
1407+ # alternative.
1408 call(['killall', 'gedit'])
1409
1410 def test_wait_for_app_running_works(self):
1411@@ -49,7 +51,8 @@
1412 start = time()
1413 t = Thread(target=start_gedit())
1414 t.start()
1415- ret = self.process_manager.wait_until_application_is_running('gedit.desktop', 10)
1416+ ret = self.process_manager.wait_until_application_is_running(
1417+ 'gedit.desktop', 10)
1418 end = time()
1419 t.join()
1420
1421@@ -57,11 +60,13 @@
1422 self.assertThat(abs(end - start - 5.0), LessThan(1))
1423
1424 def test_wait_for_app_running_times_out_correctly(self):
1425- """Make sure the bamf emulator times out correctly if no app is started."""
1426+ """Make sure the bamf emulator times out correctly if no app is
1427+ started."""
1428 self.ensure_gedit_not_running()
1429
1430 start = time()
1431- ret = self.process_manager.wait_until_application_is_running('gedit.desktop', 5)
1432+ ret = self.process_manager.wait_until_application_is_running(
1433+ 'gedit.desktop', 5)
1434 end = time()
1435
1436 self.assertThat(abs(end - start - 5.0), LessThan(1))
1437@@ -103,4 +108,3 @@
1438 # bug:1174911)
1439 ret_code = call(["pgrep", "-c", "gnome-calculato"])
1440 self.assertThat(ret_code, Equals(1), "Application is still running")
1441-

Subscribers

People subscribed via source and target branches