Merge lp:~canonical-platform-qa/camera-app/fix1444170-flake8 into lp:camera-app

Proposed by Leo Arias
Status: Merged
Approved by: Florian Boucault
Approved revision: 559
Merged at revision: 569
Proposed branch: lp:~canonical-platform-qa/camera-app/fix1444170-flake8
Merge into: lp:camera-app
Prerequisite: lp:~canonical-platform-qa/camera-app/fix_base_class
Diff against target: 680 lines (+118/-85)
13 files modified
debian/control (+1/-0)
debian/rules (+4/-0)
tests/autopilot/camera_app/emulators/main_window.py (+5/-5)
tests/autopilot/camera_app/emulators/panel.py (+5/-3)
tests/autopilot/camera_app/tests/__init__.py (+2/-5)
tests/autopilot/camera_app/tests/test_capture.py (+35/-20)
tests/autopilot/camera_app/tests/test_diskspace.py (+22/-17)
tests/autopilot/camera_app/tests/test_flash.py (+12/-9)
tests/autopilot/camera_app/tests/test_focus.py (+3/-3)
tests/autopilot/camera_app/tests/test_gallery_view.py (+10/-6)
tests/autopilot/camera_app/tests/test_options.py (+6/-3)
tests/autopilot/camera_app/tests/test_photo_editor.py (+11/-12)
tests/autopilot/camera_app/tests/test_zoom.py (+2/-2)
To merge this branch: bzr merge lp:~canonical-platform-qa/camera-app/fix1444170-flake8
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+257806@code.launchpad.net

This proposal supersedes a proposal from 2015-04-29.

Commit message

Fixed the static errors reported by flake8.
Added the check to the debian build tests.
Added python3-flake8 as a build dependency.

To post a comment you must log in.
Revision history for this message
Leo Arias (elopio) wrote : Posted in a previous version of this proposal

Initial cleanup to make the tests more readable and maintainable.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
558. By Leo Arias

Added the flake8 check to debian rules.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
559. By Leo Arias

Fixed error in trunk.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-03-12 22:20:24 +0000
3+++ debian/control 2015-05-15 07:29:30 +0000
4@@ -9,6 +9,7 @@
5 libgles2-mesa-dev | libgles2-dev,
6 pkg-config,
7 python3:any,
8+ python3-flake8,
9 qtbase5-dev,
10 qtdeclarative5-dev,
11 qtdeclarative5-qtquick2-plugin,
12
13=== modified file 'debian/rules'
14--- debian/rules 2013-06-11 16:05:35 +0000
15+++ debian/rules 2015-05-15 07:29:30 +0000
16@@ -8,6 +8,10 @@
17 %:
18 dh $@ --parallel --with translations
19
20+override_dh_auto_test:
21+ python3 -m flake8 .
22+ dh_auto_test
23+
24 override_dh_install:
25 dh_install --fail-missing
26
27
28=== modified file 'tests/autopilot/camera_app/emulators/main_window.py'
29--- tests/autopilot/camera_app/emulators/main_window.py 2015-03-10 16:14:20 +0000
30+++ tests/autopilot/camera_app/emulators/main_window.py 2015-05-15 07:29:30 +0000
31@@ -1,12 +1,10 @@
32 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
33-# Copyright 2014 Canonical
34+# Copyright 2014, 2015 Canonical
35 #
36 # This program is free software: you can redistribute it and/or modify it
37 # under the terms of the GNU General Public License version 3, as published
38 # by the Free Software Foundation.
39
40-import sys
41-
42 from camera_app.emulators.panel import Panel
43 from autopilot.matchers import Eventually
44 from testtools.matchers import Equals
45@@ -47,7 +45,8 @@
46 return self.app.wait_select_single("ShootButton")
47
48 def get_photo_roll_hint(self):
49- """Returns the layer that serves at hinting to the existence of the photo roll"""
50+ """Returns the layer that serves at hinting to the existence of the
51+ photo roll"""
52 return self.app.wait_select_single("PhotoRollHint")
53
54 def get_record_control(self):
55@@ -154,6 +153,7 @@
56 tx = x + (w // 2)
57 ty = y + (h // 2)
58
59- testCase.pointing_device.drag(tx, ty, (tx + main_view.width // 2), ty, rate=1)
60+ testCase.pointing_device.drag(
61+ tx, ty, (tx + main_view.width // 2), ty, rate=1)
62 viewfinder = self.get_viewfinder()
63 testCase.assertThat(viewfinder.inView, Eventually(Equals(True)))
64
65=== modified file 'tests/autopilot/camera_app/emulators/panel.py'
66--- tests/autopilot/camera_app/emulators/panel.py 2015-04-28 15:45:33 +0000
67+++ tests/autopilot/camera_app/emulators/panel.py 2015-05-15 07:29:30 +0000
68@@ -1,5 +1,5 @@
69 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
70-# Copyright 2014 Canonical
71+# Copyright 2014, 2015 Canonical
72 #
73 # This program is free software: you can redistribute it and/or modify it
74 # under the terms of the GNU General Public License version 3, as published
75@@ -39,7 +39,8 @@
76 start_y = y + self.height - 1
77 stop_y = y
78
79- self.pointing_device.drag(line_x, start_y, line_x, stop_y, rate=sys.maxsize)
80+ self.pointing_device.drag(
81+ line_x, start_y, line_x, stop_y, rate=sys.maxsize)
82
83 @autopilot_logging.log_action(logger.info)
84 def close(self):
85@@ -56,4 +57,5 @@
86 start_y = y
87 stop_y = y + self.height - 1
88
89- self.pointing_device.drag(line_x, start_y, line_x, stop_y, rate=sys.maxsize)
90+ self.pointing_device.drag(
91+ line_x, start_y, line_x, stop_y, rate=sys.maxsize)
92
93=== modified file 'tests/autopilot/camera_app/tests/__init__.py'
94--- tests/autopilot/camera_app/tests/__init__.py 2015-05-14 15:10:19 +0000
95+++ tests/autopilot/camera_app/tests/__init__.py 2015-05-15 07:29:30 +0000
96@@ -10,15 +10,12 @@
97 import os
98 import time
99 import shutil
100-from time import sleep
101 from pkg_resources import resource_filename
102
103 import ubuntuuitoolkit
104 from autopilot.input import Mouse, Touch, Pointer
105 from autopilot.platform import model
106 from autopilot.testcase import AutopilotTestCase
107-from autopilot.matchers import Eventually
108-from testtools.matchers import Equals
109
110 from camera_app.emulators.main_window import MainWindow
111
112@@ -94,10 +91,10 @@
113
114 def delete_all_media(self):
115 if os.path.exists(self.pictures_dir):
116- delete_all_files_in_directory(self.pictures_dir)
117+ self.delete_all_files_in_directory(self.pictures_dir)
118
119 if os.path.exists(self.videos_dir):
120- delete_all_files_in_directory(self.videos_dir)
121+ self.delete_all_files_in_directory(self.videos_dir)
122
123 def delete_all_files_in_directory(self, directory):
124 files = os.listdir(directory)
125
126=== modified file 'tests/autopilot/camera_app/tests/test_capture.py'
127--- tests/autopilot/camera_app/tests/test_capture.py 2015-03-10 14:22:52 +0000
128+++ tests/autopilot/camera_app/tests/test_capture.py 2015-05-15 07:29:30 +0000
129@@ -1,5 +1,5 @@
130 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
131-# Copyright 2012 Canonical
132+# Copyright 2012, 2015 Canonical
133 #
134 # This program is free software: you can redistribute it and/or modify it
135 # under the terms of the GNU General Public License version 3, as published
136@@ -8,7 +8,6 @@
137 """Tests for the Camera App"""
138
139 from autopilot.matchers import Eventually
140-from autopilot.platform import model
141 from testtools.matchers import Equals, NotEquals
142 from wand.image import Image
143 from MediaInfoDLL3 import MediaInfo, Stream
144@@ -26,8 +25,10 @@
145 """ This is needed to wait for the application to start.
146 In the testfarm, the application may take some time to show up."""
147 def setUp(self):
148- # Remove configuration file where knowledge of the photo roll hint's necessity is stored
149- config_file = os.path.expanduser("~/.config/com.ubuntu.camera/com.ubuntu.camera.conf")
150+ # Remove configuration file where knowledge of the photo roll hint's
151+ # necessity is stored
152+ config_file = os.path.expanduser(
153+ "~/.config/com.ubuntu.camera/com.ubuntu.camera.conf")
154 if os.path.exists(config_file):
155 os.remove(config_file)
156
157@@ -82,8 +83,12 @@
158 # check that the camera is able to capture another photo
159 self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
160
161- """Tests clicking on the record control and checks if the recording time appears"""
162 def test_record_video(self):
163+ """Test clicking on the record control.
164+
165+ Check if the recording time appears.
166+
167+ """
168 # Get all the elements
169 record_control = self.main_window.get_record_control()
170 stop_watch = self.main_window.get_stop_watch()
171@@ -164,10 +169,10 @@
172 # Check that the photo roll hint is hidden
173 self.assertEquals(hint.visible, False)
174
175- """Test that the shoot button gets disabled for a while then re-enabled
176- after shooting"""
177 @unittest.skip("Disabled this test due race condition see bug 1227373")
178 def test_shoot_button_disable(self):
179+ """Test that the shoot button gets disabled for a while then re-enabled
180+ after shooting"""
181 exposure_button = self.main_window.get_exposure_button()
182
183 # The focus ring should be invisible in the beginning
184@@ -186,8 +191,7 @@
185 def test_picture_quality_setting(self):
186 qualities = [("Basic Quality", 60),
187 ("Normal Quality", 80),
188- ("Fine Quality", 95)
189- ]
190+ ("Fine Quality", 95)]
191 for quality, expectedCompression in qualities:
192 self.delete_all_photos()
193 self.set_compression_quality(quality)
194@@ -244,12 +248,15 @@
195 bottom_edge = self.main_window.get_bottom_edge()
196 bottom_edge.open()
197
198- # open encoding quality option value selector showing the possible values
199- encoding_quality_button = self.main_window.get_encoding_quality_button()
200+ # open encoding quality option value selector showing the possible
201+ # values
202+ encoding_quality_button = (
203+ self.main_window.get_encoding_quality_button())
204 self.pointing_device.move_to_object(encoding_quality_button)
205 self.pointing_device.click()
206 option_value_selector = self.main_window.get_option_value_selector()
207- self.assertThat(option_value_selector.visible, Eventually(Equals(True)))
208+ self.assertThat(
209+ option_value_selector.visible, Eventually(Equals(True)))
210
211 # tap on chosen compression quality option
212 option = self.main_window.get_option_value_button(quality)
213@@ -281,7 +288,8 @@
214 self.record_video(2)
215 video_file = self.get_first_video()
216 height = self.read_video_height(video_file)
217- expected_height = self.height_from_resolution_label(expected_resolution)
218+ expected_height = self.height_from_resolution_label(
219+ expected_resolution)
220 self.assertThat(height, Equals(expected_height))
221
222 def switch_cameras(self):
223@@ -303,7 +311,8 @@
224 self.record_video(2)
225 video_file = self.get_first_video()
226 height = self.read_video_height(video_file)
227- expected_height = self.height_from_resolution_label(resolution_label)
228+ expected_height = self.height_from_resolution_label(
229+ resolution_label)
230 self.assertThat(height, Equals(expected_height))
231 self.dismiss_first_photo_hint()
232
233@@ -322,12 +331,15 @@
234 bottom_edge = self.main_window.get_bottom_edge()
235 bottom_edge.open()
236
237- # open video resolution option value selector showing the possible values
238- video_resolution_button = self.main_window.get_video_resolution_button()
239+ # open video resolution option value selector showing the possible
240+ # values
241+ video_resolution_button = (
242+ self.main_window.get_video_resolution_button())
243 self.pointing_device.move_to_object(video_resolution_button)
244 self.pointing_device.click()
245 option_value_selector = self.main_window.get_option_value_selector()
246- self.assertThat(option_value_selector.visible, Eventually(Equals(True)))
247+ self.assertThat(
248+ option_value_selector.visible, Eventually(Equals(True)))
249 optionButtons = option_value_selector.select_many("OptionValueButton")
250 resolutions = [button.label for button in optionButtons]
251
252@@ -344,12 +356,15 @@
253 bottom_edge = self.main_window.get_bottom_edge()
254 bottom_edge.open()
255
256- # open video resolution option value selector showing the possible values
257- video_resolution_button = self.main_window.get_video_resolution_button()
258+ # open video resolution option value selector showing the possible
259+ # values
260+ video_resolution_button = (
261+ self.main_window.get_video_resolution_button())
262 self.pointing_device.move_to_object(video_resolution_button)
263 self.pointing_device.click()
264 option_value_selector = self.main_window.get_option_value_selector()
265- self.assertThat(option_value_selector.visible, Eventually(Equals(True)))
266+ self.assertThat(
267+ option_value_selector.visible, Eventually(Equals(True)))
268
269 # tap on chosen video resolution option
270 option = self.main_window.get_option_value_button(resolution_label)
271
272=== modified file 'tests/autopilot/camera_app/tests/test_diskspace.py'
273--- tests/autopilot/camera_app/tests/test_diskspace.py 2015-01-24 22:26:48 +0000
274+++ tests/autopilot/camera_app/tests/test_diskspace.py 2015-05-15 07:29:30 +0000
275@@ -1,5 +1,5 @@
276 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
277-# Copyright 2012 Canonical
278+# Copyright 2012, 2015 Canonical
279 #
280 # This program is free software: you can redistribute it and/or modify it
281 # under the terms of the GNU General Public License version 3, as published
282@@ -12,7 +12,6 @@
283
284 from camera_app.tests import CameraAppTestCase
285
286-import unittest
287 import os.path
288 import os
289 from ctypes import CDLL, c_longlong as ll
290@@ -21,13 +20,12 @@
291 LOW_THRESHOLD = 200 * MEGABYTE
292 CRITICAL_THRESHOLD = 50 * MEGABYTE
293
294+
295 class TestCameraDiskSpace(CameraAppTestCase):
296 """Tests low disk space situations"""
297
298 def diskSpaceAvailable(self):
299 """Check the amount of free disk space"""
300-
301-
302 stats = os.statvfs(os.path.expanduser(self.videoPath))
303 return stats.f_bavail * stats.f_frsize
304
305@@ -36,9 +34,11 @@
306
307 # Take into account the currently existing filler file, if any, as we
308 # will be overwriting it to the new size.
309- fillerSize = (self.diskSpaceAvailable() + self.currentFillerSize) - size
310+ fillerSize = (
311+ self.diskSpaceAvailable() + self.currentFillerSize) - size
312 fd = open(self.diskFiller, "w")
313- ret = CDLL("libc.so.6").posix_fallocate64(fd.fileno(), ll(0), ll(fillerSize))
314+ ret = CDLL("libc.so.6").posix_fallocate64(
315+ fd.fileno(), ll(0), ll(fillerSize))
316 self.assertThat(ret, Equals(0))
317 self.currentFillerSize = fillerSize
318
319@@ -53,11 +53,12 @@
320 self.diskFiller = os.path.join(self.videoPath, "filler")
321 self.currentFillerSize = 0
322
323- # remove the filler file before starting, in case a previous test crashed
324+ # remove the filler file before starting, in case a previous test
325+ # crashed
326 os.remove(self.diskFiller) if os.path.exists(self.diskFiller) else None
327
328- # we can't start tests when the disk space is already below the threshold
329- # as they all expect a normal situation at the start
330+ # we can't start tests when the disk space is already below the
331+ # threshold as they all expect a normal situation at the start
332 self.assertThat(self.diskSpaceAvailable(), GreaterThan(LOW_THRESHOLD))
333
334 self.assertThat(
335@@ -68,7 +69,8 @@
336 os.remove(self.diskFiller) if os.path.exists(self.diskFiller) else None
337
338 def test_critically_low_disk(self):
339- """Verify proper behavior when disk space becomes critically low and back"""
340+ """Verify proper behavior when disk space becomes critically low and
341+ back"""
342
343 exposure_button = self.main_window.get_exposure_button()
344 no_space_hint = self.main_window.get_no_space_hint()
345@@ -77,22 +79,23 @@
346 self.assertThat(no_space_hint.visible, Equals(False))
347
348 self.setFreeSpaceTo(CRITICAL_THRESHOLD - MEGABYTE)
349- self.assertThat(self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD))
350+ self.assertThat(
351+ self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD))
352
353 self.assertThat(exposure_button.enabled, Eventually(Equals(False)))
354 self.assertThat(no_space_hint.visible, Eventually(Equals(True)))
355
356 self.setFreeSpaceTo(CRITICAL_THRESHOLD + MEGABYTE)
357- self.assertThat(self.diskSpaceAvailable(), GreaterThan(CRITICAL_THRESHOLD))
358+ self.assertThat(
359+ self.diskSpaceAvailable(), GreaterThan(CRITICAL_THRESHOLD))
360
361 self.assertThat(exposure_button.enabled, Equals(True))
362 self.assertThat(no_space_hint.visible, Equals(False))
363
364 def test_low_disk(self):
365 """Verify proper behavior when disk space becomes low"""
366-
367- exposure_button = self.main_window.get_exposure_button()
368- no_space_hint = self.main_window.get_no_space_hint()
369+ self.main_window.get_exposure_button()
370+ self.main_window.get_no_space_hint()
371 dialog = self.main_window.get_low_space_dialog()
372 self.assertThat(dialog, Equals(None))
373
374@@ -109,7 +112,8 @@
375 stop_watch = self.main_window.get_stop_watch()
376 exposure_button = self.main_window.get_exposure_button()
377
378- # Click the record button to toggle photo/video mode then start recording
379+ # Click the record button to toggle photo/video mode then start
380+ # recording
381 self.pointing_device.move_to_object(record_control)
382 self.pointing_device.click()
383 self.pointing_device.move_to_object(exposure_button)
384@@ -121,5 +125,6 @@
385
386 # Now reduce the space to critically low, then see if recording stops
387 self.setFreeSpaceTo(CRITICAL_THRESHOLD - MEGABYTE)
388- self.assertThat(self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD))
389+ self.assertThat(
390+ self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD))
391 self.assertThat(stop_watch.opacity, Eventually(Equals(0.0)))
392
393=== modified file 'tests/autopilot/camera_app/tests/test_flash.py'
394--- tests/autopilot/camera_app/tests/test_flash.py 2015-02-17 18:04:01 +0000
395+++ tests/autopilot/camera_app/tests/test_flash.py 2015-05-15 07:29:30 +0000
396@@ -1,5 +1,5 @@
397 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
398-# Copyright 2012 Canonical
399+# Copyright 2012, 2015 Canonical
400 #
401 # This program is free software: you can redistribute it and/or modify it
402 # under the terms of the GNU General Public License version 3, as published
403@@ -7,13 +7,11 @@
404
405 """Tests for the Camera App flash"""
406
407-from testtools.matchers import Equals, NotEquals
408+from testtools.matchers import Equals
409 from autopilot.matchers import Eventually
410
411 from camera_app.tests import CameraAppTestCase
412
413-import unittest
414-
415
416 class TestCameraFlash(CameraAppTestCase):
417 """Tests the flash"""
418@@ -104,7 +102,8 @@
419 # open option value selector showing the possible values
420 self.pointing_device.move_to_object(flash_button)
421 self.pointing_device.click()
422- self.assertThat(option_value_selector.visible, Eventually(Equals(True)))
423+ self.assertThat(
424+ option_value_selector.visible, Eventually(Equals(True)))
425
426 # set flash to "on"
427 option = self.main_window.get_option_value_button("On")
428@@ -115,9 +114,11 @@
429 # closes the flash options menu and open the hdr options menu
430 self.pointing_device.move_to_object(hdr_button)
431 self.pointing_device.click()
432- self.assertThat(option_value_selector.visible, Eventually(Equals(False)))
433+ self.assertThat(
434+ option_value_selector.visible, Eventually(Equals(False)))
435 self.pointing_device.click()
436- self.assertThat(option_value_selector.visible, Eventually(Equals(True)))
437+ self.assertThat(
438+ option_value_selector.visible, Eventually(Equals(True)))
439
440 # set hdr to "on" and verify that flash is "off"
441 option = self.main_window.get_option_value_button("On")
442@@ -129,9 +130,11 @@
443 # closes the hdr options menu and open the flash options menu
444 self.pointing_device.move_to_object(flash_button)
445 self.pointing_device.click()
446- self.assertThat(option_value_selector.visible, Eventually(Equals(False)))
447+ self.assertThat(
448+ option_value_selector.visible, Eventually(Equals(False)))
449 self.pointing_device.click()
450- self.assertThat(option_value_selector.visible, Eventually(Equals(True)))
451+ self.assertThat(
452+ option_value_selector.visible, Eventually(Equals(True)))
453
454 # set flash to "on" and verify that hdr is "off"
455 option = self.main_window.get_option_value_button("On")
456
457=== modified file 'tests/autopilot/camera_app/tests/test_focus.py'
458--- tests/autopilot/camera_app/tests/test_focus.py 2014-06-30 07:57:09 +0000
459+++ tests/autopilot/camera_app/tests/test_focus.py 2015-05-15 07:29:30 +0000
460@@ -1,5 +1,5 @@
461 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
462-# Copyright 2012 Canonical
463+# Copyright 2012, 2015 Canonical
464 #
465 # This program is free software: you can redistribute it and/or modify it
466 # under the terms of the GNU General Public License version 3, as published
467@@ -45,7 +45,7 @@
468
469 # The focus ring sould be visible and centered to the mouse click
470 # coords now
471- focus_ring_center = self.get_center(focus_ring)
472+ # focus_ring_center = self.get_center(focus_ring)
473 self.assertThat(focus_ring.opacity, Eventually(GreaterThan(0.5)))
474 # self.assertEquals(focus_ring_center, click_coords)
475
476@@ -65,7 +65,7 @@
477
478 # The focus ring sould be visible and centered to the mouse
479 # click coords now
480- focus_ring_center = self.get_center(focus_ring)
481+ # focus_ring_center = self.get_center(focus_ring)
482 self.assertThat(focus_ring.opacity, Eventually(GreaterThan(0.5)))
483 # self.assertEquals(focus_ring_center, click_coords)
484
485
486=== modified file 'tests/autopilot/camera_app/tests/test_gallery_view.py'
487--- tests/autopilot/camera_app/tests/test_gallery_view.py 2015-03-10 16:33:24 +0000
488+++ tests/autopilot/camera_app/tests/test_gallery_view.py 2015-05-15 07:29:30 +0000
489@@ -1,5 +1,5 @@
490 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
491-# Copyright 2014 Canonical
492+# Copyright 2014, 2015 Canonical
493 #
494 # This program is free software: you can redistribute it and/or modify it
495 # under the terms of the GNU General Public License version 3, as published
496@@ -7,15 +7,14 @@
497
498 """Tests for the Camera App zoom"""
499
500-from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan
501+from testtools.matchers import Equals
502 from autopilot.matchers import Eventually
503
504 from camera_app.tests import CameraAppTestCase
505
506-import unittest
507-import os
508 from time import sleep
509
510+
511 class TestCameraGalleryViewMixin(object):
512 def move_from_slideshow_to_photogrid(self):
513 gallery = self.main_window.get_gallery()
514@@ -47,6 +46,7 @@
515 sleep(1)
516 self.pointing_device.release()
517
518+
519 class TestCameraGalleryView(CameraAppTestCase, TestCameraGalleryViewMixin):
520 """Tests the camera gallery view without media already present"""
521
522@@ -104,7 +104,9 @@
523
524 self.assertThat(hint.visible, Eventually(Equals(False)))
525
526-class TestCameraGalleryViewWithVideo(TestCameraGalleryViewMixin, CameraAppTestCase):
527+
528+class TestCameraGalleryViewWithVideo(
529+ TestCameraGalleryViewMixin, CameraAppTestCase):
530 """Tests the camera gallery view with video already present"""
531
532 def setUp(self):
533@@ -131,7 +133,9 @@
534 spinner = gallery.wait_select_single("ActivityIndicator")
535 self.assertThat(spinner.running, Eventually(Equals(False)))
536
537-class TestCameraGalleryViewWithPhoto(TestCameraGalleryViewMixin, CameraAppTestCase):
538+
539+class TestCameraGalleryViewWithPhoto(
540+ TestCameraGalleryViewMixin, CameraAppTestCase):
541 """Tests the camera gallery view with photo already present"""
542
543 def setUp(self):
544
545=== modified file 'tests/autopilot/camera_app/tests/test_options.py'
546--- tests/autopilot/camera_app/tests/test_options.py 2014-12-08 12:04:21 +0000
547+++ tests/autopilot/camera_app/tests/test_options.py 2015-05-15 07:29:30 +0000
548@@ -1,5 +1,5 @@
549 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
550-# Copyright 2014 Canonical
551+# Copyright 2014, 2015 Canonical
552 #
553 # This program is free software: you can redistribute it and/or modify it
554 # under the terms of the GNU General Public License version 3, as published
555@@ -12,6 +12,7 @@
556
557 from camera_app.tests import CameraAppTestCase
558
559+
560 class TestCameraOptions(CameraAppTestCase):
561 """Tests the options overlay"""
562
563@@ -43,7 +44,8 @@
564
565 """Test toggling on/off grid lines option"""
566 def test_toggle_grid_lines(self):
567- gridlines = self.app.wait_select_single("QQuickItem", objectName="gridlines")
568+ gridlines = self.app.wait_select_single(
569+ "QQuickItem", objectName="gridlines")
570 self.set_grid_lines_value("On")
571 self.assertEquals(gridlines.visible, True)
572 self.set_grid_lines_value("Off")
573@@ -59,7 +61,8 @@
574 self.pointing_device.move_to_object(grid_lines_button)
575 self.pointing_device.click()
576 option_value_selector = self.main_window.get_option_value_selector()
577- self.assertThat(option_value_selector.visible, Eventually(Equals(True)))
578+ self.assertThat(
579+ option_value_selector.visible, Eventually(Equals(True)))
580
581 # tap on chosen value
582 option = self.main_window.get_option_value_button(value)
583
584=== modified file 'tests/autopilot/camera_app/tests/test_photo_editor.py'
585--- tests/autopilot/camera_app/tests/test_photo_editor.py 2015-03-11 09:25:36 +0000
586+++ tests/autopilot/camera_app/tests/test_photo_editor.py 2015-05-15 07:29:30 +0000
587@@ -1,5 +1,5 @@
588 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
589-# Copyright 2014 Canonical
590+# Copyright 2014, 2015 Canonical
591 #
592 # This program is free software: you can redistribute it and/or modify it
593 # under the terms of the GNU General Public License version 3, as published
594@@ -7,16 +7,12 @@
595
596 """Tests for the Camera photo editor"""
597
598-from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan
599+from testtools.matchers import Equals
600 from autopilot.matchers import Eventually
601 from autopilot.exceptions import StateNotFoundError
602
603 from camera_app.tests import CameraAppTestCase
604
605-import unittest
606-import os
607-from time import sleep
608-
609
610 class TestCameraPhotoEditorWithPhoto(CameraAppTestCase):
611 """Tests photo editor when a photo is present"""
612@@ -35,7 +31,7 @@
613 """Tests editor opening and closing correctly for pictures"""
614 def test_editor_appears(self):
615
616- viewfinder = self.main_window.get_viewfinder()
617+ self.main_window.get_viewfinder()
618 gallery = self.main_window.get_gallery()
619
620 self.main_window.swipe_to_gallery(self)
621@@ -48,8 +44,9 @@
622 self.pointing_device.click()
623
624 # If the editor button is not there when in the gallery view, then
625- # we are not on a system that has the UI extras package installed or has
626- # an older version than the one we need. Skip the test in this case.
627+ # we are not on a system that has the UI extras package installed or
628+ # has an older version than the one we need. Skip the test in this
629+ # case.
630 try:
631 edit = gallery.wait_select_single(objectName="actionButtonEdit")
632 except:
633@@ -81,6 +78,7 @@
634 disappeared = True
635 self.assertThat(disappeared, Equals(True))
636
637+
638 class TestCameraPhotoEditorWithVideo(CameraAppTestCase):
639 """Tests photo editor when a video is present"""
640
641@@ -99,7 +97,7 @@
642 def test_editor_not_on_videos(self):
643 self.add_sample_video()
644
645- viewfinder = self.main_window.get_viewfinder()
646+ self.main_window.get_viewfinder()
647 gallery = self.main_window.get_gallery()
648
649 self.main_window.swipe_to_gallery(self)
650@@ -112,8 +110,9 @@
651 self.pointing_device.click()
652
653 # If the editor button is not there when in the gallery view, then
654- # we are not on a system that has the UI extras package installed or has
655- # an older version than the one we need. Skip the test in this case.
656+ # we are not on a system that has the UI extras package installed or
657+ # has an older version than the one we need. Skip the test in this
658+ # case.
659 try:
660 edit = gallery.wait_select_single(objectName="actionButtonEdit")
661 except:
662
663=== modified file 'tests/autopilot/camera_app/tests/test_zoom.py'
664--- tests/autopilot/camera_app/tests/test_zoom.py 2014-09-08 14:12:42 +0000
665+++ tests/autopilot/camera_app/tests/test_zoom.py 2015-05-15 07:29:30 +0000
666@@ -1,5 +1,5 @@
667 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
668-# Copyright 2014 Canonical
669+# Copyright 2014, 2015 Canonical
670 #
671 # This program is free software: you can redistribute it and/or modify it
672 # under the terms of the GNU General Public License version 3, as published
673@@ -7,7 +7,7 @@
674
675 """Tests for the Camera App zoom"""
676
677-from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan
678+from testtools.matchers import Equals
679 from autopilot.matchers import Eventually
680 from autopilot.gestures import pinch
681

Subscribers

People subscribed via source and target branches