Merge lp:~jibel/ubiquity/fix_pep8_autopilot into lp:ubiquity
- fix_pep8_autopilot
- Merge into trunk
Proposed by
Jean-Baptiste Lallement
Status: | Merged |
---|---|
Merge reported by: | Dan Chapman |
Merged at revision: | not available |
Proposed branch: | lp:~jibel/ubiquity/fix_pep8_autopilot |
Merge into: | lp:ubiquity |
Diff against target: |
2132 lines (+637/-431) 21 files modified
autopilot/ubiquity_autopilot_tests/configs/default_install.py (+0/-1) autopilot/ubiquity_autopilot_tests/configs/eng_label_values.py (+30/-20) autopilot/ubiquity_autopilot_tests/configs/partconfig.py (+3/-2) autopilot/ubiquity_autopilot_tests/emulators/gtkaccessible.py (+4/-2) autopilot/ubiquity_autopilot_tests/emulators/gtkcontainers.py (+62/-45) autopilot/ubiquity_autopilot_tests/emulators/gtkcontrols.py (+68/-37) autopilot/ubiquity_autopilot_tests/emulators/gtktoplevel.py (+70/-42) autopilot/ubiquity_autopilot_tests/emulators/partconfig.py (+2/-1) autopilot/ubiquity_autopilot_tests/testcase.py (+8/-4) autopilot/ubiquity_autopilot_tests/tests/__init__.py (+290/-215) autopilot/ubiquity_autopilot_tests/tests/test_custom_install.py (+11/-5) autopilot/ubiquity_autopilot_tests/tests/test_english_default.py (+11/-6) autopilot/ubiquity_autopilot_tests/tests/test_english_encrypt_lvm.py (+11/-5) autopilot/ubiquity_autopilot_tests/tests/test_english_lvm.py (+10/-5) autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_default.py (+11/-6) autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_encrypt_lvm.py (+11/-5) autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_lvm.py (+10/-5) autopilot/ubiquity_autopilot_tests/tools/_exc.py (+1/-1) autopilot/ubiquity_autopilot_tests/tools/compare.py (+23/-22) autopilot/ubiquity_autopilot_tests/unittests/test_matchers.py (+0/-1) tests/run-pep8 (+1/-1) |
To merge this branch: | bzr merge lp:~jibel/ubiquity/fix_pep8_autopilot |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dan Chapman (community) | Approve | ||
Ubuntu Installer Team | Pending | ||
Review via email: mp+195734@code.launchpad.net |
Commit message
pep8 compliance of autopilot tests
Description of the change
This patch fixes autopilot tests to be pep8 compliant and adds the directory autopilot/ to tests/run-pep8.
I essentially changed line width (244 errors over 261 initially reported).
I ran debian/rules clean and both run-pep8 and run-pyflakes tests pass. I also tried Ubuntu Desktop non-english and Xubuntu Desktop english and they succeeded.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'autopilot/ubiquity_autopilot_tests/configs/default_install.py' |
2 | --- autopilot/ubiquity_autopilot_tests/configs/default_install.py 2013-11-06 11:22:15 +0000 |
3 | +++ autopilot/ubiquity_autopilot_tests/configs/default_install.py 2013-11-19 09:56:21 +0000 |
4 | @@ -7,4 +7,3 @@ |
5 | hidden_options = ['reuse_partition', 'reuse_partition_desc', |
6 | 'resize_use_free', 'resize_use_free_desc', |
7 | 'replace_partition', 'replace_partition_desc'] |
8 | - |
9 | |
10 | === modified file 'autopilot/ubiquity_autopilot_tests/configs/eng_label_values.py' |
11 | --- autopilot/ubiquity_autopilot_tests/configs/eng_label_values.py 2013-11-14 14:16:45 +0000 |
12 | +++ autopilot/ubiquity_autopilot_tests/configs/eng_label_values.py 2013-11-19 09:56:21 +0000 |
13 | @@ -27,16 +27,20 @@ |
14 | distro_flavor = get_distribution() |
15 | |
16 | stepLanguage = { |
17 | - "release_notes_label": 'You may wish to read the <a href="release-notes">release notes</a>.', |
18 | + "release_notes_label": 'You may wish to read the <a href="release-notes">' |
19 | + 'release notes</a>.', |
20 | "page_title": 'page_title= <span size="xx-large">Welcome</span>' |
21 | } |
22 | |
23 | stepPrepare = { |
24 | - "page_title": '<span size="xx-large">Preparing to install {0}</span>'.format(distro_flavor), |
25 | - "prepare_best_results": 'For best results, please ensure that this computer:', |
26 | - "prepare_foss_disclaimer": 'Ubuntu uses third-party software to play Flash, MP3 and other media, and to work with \ |
27 | - some graphics and wi-fi hardware. Some of this software is proprietary. The software is subject to license terms \ |
28 | - included with its documentation.', |
29 | + "page_title": '<span size="xx-large">Preparing to install {0}</span>' |
30 | + .format(distro_flavor), |
31 | + "prepare_best_results": 'For best results, please ensure that this ' |
32 | + 'computer:', |
33 | + "prepare_foss_disclaimer": 'Ubuntu uses third-party software to play ' |
34 | + 'Flash, MP3 and other media, and to work with some graphics and wi-fi ' |
35 | + 'hardware. Some of this software is proprietary. The software is subject ' |
36 | + 'to license terms included with its documentation.', |
37 | "prepare_download_updates": 'Download updates while installing', |
38 | "prepare_nonfree_software": 'Install this third-party software', |
39 | "prepare_network_connection": 'is connected to the Internet', |
40 | @@ -47,16 +51,18 @@ |
41 | stepPartAsk = { |
42 | "page_title": '<span size="xx-large">Installation type</span>', |
43 | "use_device": 'Erase disk and install {0}'.format(distro_flavor), |
44 | - "use_device_desc": '<span size="small"><span foreground="darkred">Warning:</span> \ |
45 | - This will delete any files on the disk.</span>', |
46 | + "use_device_desc": '<span size="small"><span foreground="darkred">' |
47 | + 'Warning:</span> This will delete any files on the disk.</span>', |
48 | "use_crypto": 'Encrypt the new Ubuntu installation for security', |
49 | - "use_crypto_desc": '<span size="small">You will choose a security key in the next step.</span>', |
50 | + "use_crypto_desc": '<span size="small">You will choose a security key in ' |
51 | + 'the next step.</span>', |
52 | "use_lvm": 'Use LVM with the new Ubuntu installation', |
53 | - "use_lvm_desc": '<span size="small">This will set up Logical Volume Management. It allows taking snapshots and \ |
54 | - easier partition resizing.</span>', |
55 | + "use_lvm_desc": '<span size="small">This will set up Logical Volume ' |
56 | + 'Management. It allows taking snapshots and easier partition ' |
57 | + 'resizing.</span>', |
58 | "custom_partitioning": 'Something else', |
59 | - "custom_partitioning_desc": '<span size="small">You can create or resize partitions yourself, or choose multiple \ |
60 | - partitions for Ubuntu.</span>' |
61 | + "custom_partitioning_desc": '<span size="small">You can create or resize ' |
62 | + 'partitions yourself, or choose multiple partitions for Ubuntu.</span>' |
63 | } |
64 | |
65 | |
66 | @@ -64,13 +70,16 @@ |
67 | "page_title": '<span size="xx-large">Choose a security key:</span>', |
68 | "verified_crypto_label": 'Confirm the security key:', |
69 | "crypto_label": 'Choose a security key:', |
70 | - "crypto_description": 'Disk encryption protects your files in case you lose your computer. It requires you to \ |
71 | - enter a security key each time the computer starts up.', |
72 | - "crypto_warning": '<span foreground="darkred">Warning:</span> If you lose this security key, all data will be \ |
73 | - lost. If you need to, write down your key and keep it in a safe place elsewhere.', |
74 | + "crypto_description": 'Disk encryption protects your files in case you ' |
75 | + 'lose your computer. It requires you to enter a security key each time ' |
76 | + 'the computer starts up.', |
77 | + "crypto_warning": '<span foreground="darkred">Warning:</span> If you lose ' |
78 | + 'this security key, all data will be lost. If you need to, write down ' |
79 | + 'your key and keep it in a safe place elsewhere.', |
80 | "crypto_extra_label": 'For more security:', |
81 | "crypto_extra_time": 'The installation may take much longer.', |
82 | - "crypto_description_2": 'Any files outside of Ubuntu will not be encrypted.', |
83 | + "crypto_description_2": 'Any files outside of Ubuntu will not be ' |
84 | + 'encrypted.', |
85 | "crypto_overwrite_space": 'Overwrite empty disk space' |
86 | } |
87 | |
88 | @@ -88,5 +97,6 @@ |
89 | "username_label": 'Pick a username:', |
90 | "password_label": 'Choose a password:', |
91 | "verified_password_label": 'Confirm your password:', |
92 | - "hostname_extra_label": 'The name it uses when it talks to other computers.' |
93 | -} |
94 | \ No newline at end of file |
95 | + "hostname_extra_label": 'The name it uses when it talks to other ' |
96 | + 'computers.' |
97 | +} |
98 | |
99 | === modified file 'autopilot/ubiquity_autopilot_tests/configs/partconfig.py' |
100 | --- autopilot/ubiquity_autopilot_tests/configs/partconfig.py 2013-11-15 17:10:36 +0000 |
101 | +++ autopilot/ubiquity_autopilot_tests/configs/partconfig.py 2013-11-19 09:56:21 +0000 |
102 | @@ -11,8 +11,9 @@ |
103 | 'PartitionSize': int, # an int value of size in MB If set to None, |
104 | we use up all remaining space |
105 | |
106 | + # These are the current available mount points |
107 | 'MountPoint': /, /boot, /home, |
108 | - /tmp, /usr, /var, # These are the current available mount points |
109 | + /tmp, /usr, /var, |
110 | /srv, /opt, /usr/local |
111 | |
112 | 'FileSystemType': 'Ext2','Ext3', 'Ext4', 'ReiserFs', |
113 | @@ -280,4 +281,4 @@ |
114 | 'PartitionType': 'Primary', |
115 | 'Position': 'Beginning' |
116 | } |
117 | -] |
118 | \ No newline at end of file |
119 | +] |
120 | |
121 | === modified file 'autopilot/ubiquity_autopilot_tests/emulators/gtkaccessible.py' |
122 | --- autopilot/ubiquity_autopilot_tests/emulators/gtkaccessible.py 2013-11-12 19:27:27 +0000 |
123 | +++ autopilot/ubiquity_autopilot_tests/emulators/gtkaccessible.py 2013-11-19 09:56:21 +0000 |
124 | @@ -55,7 +55,8 @@ |
125 | logger.debug('Selecting {0} item'.format(label)) |
126 | item = self._get_item(label) |
127 | if item is None: |
128 | - raise ValueError("Could not select item with label {0}".format(label)) |
129 | + raise ValueError("Could not select item with label {0}" |
130 | + .format(label)) |
131 | logger.debug('{0} item found, returning item'.format(label)) |
132 | return item |
133 | |
134 | @@ -93,7 +94,8 @@ |
135 | |
136 | def _get_item(self, label): |
137 | """ Gets an item in a GtkTreeView """ |
138 | - return self.select_single('GtkTextCellAccessible', accessible_name=label) |
139 | + return self.select_single('GtkTextCellAccessible', |
140 | + accessible_name=label) |
141 | |
142 | |
143 | class GtkNoteBookAccessible(AutopilotGtkEmulatorBase): |
144 | |
145 | === modified file 'autopilot/ubiquity_autopilot_tests/emulators/gtkcontainers.py' |
146 | --- autopilot/ubiquity_autopilot_tests/emulators/gtkcontainers.py 2013-11-13 09:41:47 +0000 |
147 | +++ autopilot/ubiquity_autopilot_tests/emulators/gtkcontainers.py 2013-11-19 09:56:21 +0000 |
148 | @@ -4,14 +4,14 @@ |
149 | # |
150 | # Author: Daniel Chapman daniel@chapman-mail.com |
151 | # |
152 | -# This program is free software; you can redistribute it and/or modify |
153 | -# it under the terms of the GNU Lesser General Public License as published by |
154 | -# the Free Software Foundation; version 3. |
155 | +# This program is free software; you can redistribute it and/or modify it under |
156 | +# the terms of the GNU Lesser General Public License as published by the Free |
157 | +# Software Foundation; version 3. |
158 | # |
159 | -# This program is distributed in the hope that it will be useful, |
160 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
161 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
162 | -# GNU Lesser General Public License for more details. |
163 | +# This program is distributed in the hope that it will be useful, but WITHOUT |
164 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
165 | +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
166 | +# details. |
167 | # |
168 | # You should have received a copy of the GNU Lesser General Public License |
169 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
170 | @@ -55,18 +55,20 @@ |
171 | if language_item is None: |
172 | raise ValueError("Language could not be selected") |
173 | return language_item |
174 | - raise RuntimeError("Function can only be used from a stepLanguage \ |
175 | - page object. Use .select_single('GtkBox, name='stepLanguage')") |
176 | + raise RuntimeError("Function can only be used from a stepLanguage " |
177 | + "page object. Use .select_single('GtkBox, " |
178 | + "name='stepLanguage')") |
179 | |
180 | def select_language(self, item): |
181 | """ Selects a language for the install |
182 | |
183 | - You can either use get_random_language or if you want to set the install |
184 | - language instead of randomly selecting an item. Then select from the treeview |
185 | - using GtkTreeView.select_item and pass the returned item to select_language |
186 | + You can either use get_random_language or if you want to set the |
187 | + install language instead of randomly selecting an item. Then select |
188 | + from the treeview using GtkTreeView.select_item and pass the returned |
189 | + item to select_language |
190 | |
191 | :param item: A treeview item object |
192 | - :raises: exception if function not called from stepLanguage page object" |
193 | + :raises: exception if function not called from stepLanguage page object |
194 | |
195 | |
196 | """ |
197 | @@ -81,7 +83,8 @@ |
198 | top_item = tree_items[0] |
199 | #If we are at the top |
200 | if top_item.selected: |
201 | - logger.debug("top item {0} selected".format(top_item.accessible_name)) |
202 | + logger.debug("top item {0} selected" |
203 | + .format(top_item.accessible_name)) |
204 | #Now select required Language |
205 | self.kbd.type(item.accessible_name[0:2]) |
206 | item.click() |
207 | @@ -91,8 +94,9 @@ |
208 | return |
209 | raise ValueError("Could not select Item") |
210 | raise ValueError("Top item not selected") |
211 | - raise ValueError("Function can only be used from a stepLanguage \ |
212 | - page object. Use .select_single('GtkBox, name='stepLanguage')") |
213 | + raise ValueError("Function can only be used from a stepLanguage page " |
214 | + "object. Use .select_single('GtkBox, " |
215 | + "name='stepLanguage')") |
216 | |
217 | def _get_install_language(self, ): |
218 | """ Gets a random language for the install |
219 | @@ -143,7 +147,7 @@ |
220 | pos = self.pointing_device.position() |
221 | x = pos[0] |
222 | y = pos[1] |
223 | - x -= 25# px |
224 | + x -= 25 # px |
225 | self.pointing_device.move(x, y) |
226 | while True: |
227 | entry = self.select_single('GtkEntry') |
228 | @@ -151,19 +155,22 @@ |
229 | pos = self.pointing_device.position() |
230 | x = pos[0] |
231 | y = pos[1] |
232 | - y -= 10# px |
233 | + y -= 10 # px |
234 | self.pointing_device.move(x, y) |
235 | self.pointing_device.click() |
236 | if y < y1: |
237 | - logger.warning("We missed the location on the map and ended up outside the globalRect. \ |
238 | - Now using the default selected location instead") |
239 | + logger.warning("We missed the location on the map and " |
240 | + "ended up outside the globalRect. Now " |
241 | + "using the default selected location " |
242 | + "instead") |
243 | break |
244 | else: |
245 | expectThat(entry.text).equals(location) |
246 | logger.debug("Location; '{0}' selected".format(location)) |
247 | break |
248 | else: |
249 | - raise ValueError("Function can only be called from a stepLocation page object") |
250 | + raise ValueError("Function can only be called from a " |
251 | + "stepLocation page object") |
252 | |
253 | def create_user(self, name, password): |
254 | """ Creates a user account with password |
255 | @@ -177,7 +184,8 @@ |
256 | self._enter_username(name) |
257 | self._enter_password(password) |
258 | else: |
259 | - raise ValueError ("Function can only be called froma stepUserInfo page object") |
260 | + raise ValueError("Function can only be called froma stepUserInfo" |
261 | + "page object") |
262 | |
263 | def _enter_username(self, name): |
264 | """ Enters the username |
265 | @@ -194,30 +202,35 @@ |
266 | #lets get the fullname from the entry |
267 | # as we don't know the kb layout till runtime |
268 | fullname = entry.text |
269 | - logger.debug("Checking that name, username and hostname all contain '{0}'".format(name)) |
270 | + logger.debug("Checking that name, username and hostname all contain " |
271 | + "'{0}'".format(name)) |
272 | #now check computer name contains username |
273 | hostname_entry = self.select_single('GtkEntry', name='hostname') |
274 | expectThat(hostname_entry.text).contains( |
275 | fullname.lower(), |
276 | - msg="GtkBox._enter_username(): Expected the hostname entry: '{0}', to contain '{1}'".format( |
277 | - hostname_entry.text, |
278 | - fullname.lower())) |
279 | + msg="GtkBox._enter_username(): Expected the hostname entry: " |
280 | + "'{0}', to contain '{1}'" |
281 | + .format(hostname_entry.text, fullname.lower())) |
282 | #check username contains name |
283 | username_entry = self.select_single('GtkEntry', name='username') |
284 | expectThat(username_entry.text).contains( |
285 | fullname.lower(), |
286 | - msg="GtkBox._enter_username(): Expected the username entry: '{0}', to contain '{1}'".format( |
287 | - username_entry.text, |
288 | - fullname.lower())) |
289 | + msg="GtkBox._enter_username(): Expected the username entry: " |
290 | + "'{0}', to contain '{1}'" |
291 | + .format(username_entry.text, fullname.lower())) |
292 | #check the GtkYes images are now visible |
293 | logger.debug("Checking the stock 'gtk-yes' images are visible") |
294 | images = ['fullname_ok', 'hostname_ok', 'username_ok'] |
295 | for image in images: |
296 | img = self.select_single('GtkImage', name=image) |
297 | - expectThat(img.visible).equals(True, msg="Expected {0} image to be visible but it wasn't".format(img.name)) |
298 | - expectThat(img.stock).equals('gtk-yes', |
299 | - msg="Expected {0} image to have a 'gtk-yes' stock image and not {1}".format( |
300 | - img.name, img.stock)) |
301 | + expectThat(img.visible).equals( |
302 | + True, |
303 | + msg="Expected {0} image to be visible but it wasn't" |
304 | + .format(img.name)) |
305 | + expectThat(img.stock).equals( |
306 | + 'gtk-yes', |
307 | + msg="Expected {0} image to have a 'gtk-yes' stock image and " |
308 | + "not {1}".format(img.name, img.stock)) |
309 | |
310 | def _enter_password(self, password): |
311 | if self.name == 'stepUserInfo': |
312 | @@ -229,9 +242,8 @@ |
313 | if match: |
314 | break |
315 | else: |
316 | - raise ValueError( |
317 | - "enter_crypto_phrase() can only be called from stepPartCrypto page object" |
318 | - ) |
319 | + raise ValueError("enter_crypto_phrase() can only be called from " |
320 | + "stepPartCrypto page object") |
321 | |
322 | def _enter_pass_phrase(self, phrase): |
323 | |
324 | @@ -241,7 +253,10 @@ |
325 | with self.kbd.focused_type(entry) as kb: |
326 | kb.press_and_release('Ctrl+a') |
327 | kb.press_and_release('Delete') |
328 | - expectThat(entry.text).equals(u'', msg='{0} entry text was not cleared properly'.format(entry.name)) |
329 | + expectThat(entry.text).equals( |
330 | + u'', |
331 | + msg='{0} entry text was not cleared properly' |
332 | + .format(entry.name)) |
333 | kb.type(phrase) |
334 | |
335 | def _check_phrase_match(self, ): |
336 | @@ -270,9 +285,8 @@ |
337 | if match: |
338 | break |
339 | else: |
340 | - raise ValueError( |
341 | - "enter_crypto_phrase() can only be called from stepPartCrypto page object" |
342 | - ) |
343 | + raise ValueError("enter_crypto_phrase() can only be called from " |
344 | + "stepPartCrypto page object") |
345 | |
346 | def _enter_pass_phrase(self, phrase): |
347 | |
348 | @@ -282,7 +296,10 @@ |
349 | with self.kbd.focused_type(entry) as kb: |
350 | kb.press_and_release('Ctrl+a') |
351 | kb.press_and_release('Delete') |
352 | - expectThat(entry.text).equals(u'', msg='{0} entry text was not cleared properly'.format(entry.name)) |
353 | + expectThat(entry.text).equals( |
354 | + u'', |
355 | + msg='{0} entry text was not cleared properly' |
356 | + .format(entry.name)) |
357 | kb.type(phrase) |
358 | |
359 | def _check_crypto_phrase_match(self, ): |
360 | @@ -295,13 +312,13 @@ |
361 | |
362 | def create_new_partition_table(self, ): |
363 | if self.name == 'stepPartAdvanced': |
364 | - new_partition_button = self.select_single(BuilderName='partition_button_new_label') |
365 | + new_partition_button = self.select_single( |
366 | + BuilderName='partition_button_new_label') |
367 | self.pointing_device.click_object(new_partition_button) |
368 | time.sleep(5) |
369 | self.kbd.press_and_release('Right') |
370 | self.kbd.press_and_release('Enter') |
371 | time.sleep(5) |
372 | else: |
373 | - raise ValueError( |
374 | - "create_new_partition_table() can only be called from stepPartAdvanced page object" |
375 | - ) |
376 | + raise ValueError("create_new_partition_table() can only be called " |
377 | + "from stepPartAdvanced page object") |
378 | |
379 | === modified file 'autopilot/ubiquity_autopilot_tests/emulators/gtkcontrols.py' |
380 | --- autopilot/ubiquity_autopilot_tests/emulators/gtkcontrols.py 2013-11-12 19:57:55 +0000 |
381 | +++ autopilot/ubiquity_autopilot_tests/emulators/gtkcontrols.py 2013-11-19 09:56:21 +0000 |
382 | @@ -44,9 +44,10 @@ |
383 | def click(self,): |
384 | """ Clicks a GtkButton widget |
385 | |
386 | - On some occasions you may need to wait for a button to become sensitive. |
387 | - So when calling this function if the sensitive property is 0 it will wait for 10 seconds |
388 | - for button to become sensitive before clicking |
389 | + On some occasions you may need to wait for a button to become |
390 | + sensitive. |
391 | + So when calling this function if the sensitive property is 0 it will |
392 | + wait for 10 seconds for button to become sensitive before clicking |
393 | """ |
394 | #sometimes we may need to wait for the button to become clickable |
395 | # so lets wait for it if we do |
396 | @@ -69,9 +70,15 @@ |
397 | |
398 | def check(self, visible=True): |
399 | expectThat(self.label).is_unicode() |
400 | - expectThat(self.label).not_equals(u'', msg="Expected {0} label to contain text, but its empty".format(self.name)) |
401 | - expectThat(self.visible).equals(visible, |
402 | - msg="Expected {0} label to be visible, but its wasn't".format(self.name)) |
403 | + expectThat(self.label).not_equals( |
404 | + u'', |
405 | + msg="Expected {0} label to contain text, but its empty" |
406 | + .format(self.name)) |
407 | + expectThat(self.visible).equals( |
408 | + visible, |
409 | + msg="Expected {0} label to be visible, but its wasn't" |
410 | + .format(self.name)) |
411 | + |
412 | |
413 | class GtkToggleButton(AutopilotGtkEmulatorBase): |
414 | """ Emulator for a GtkToggleButton instance """ |
415 | @@ -81,9 +88,14 @@ |
416 | |
417 | def check(self, visible=True): |
418 | expectThat(self.label).is_unicode() |
419 | - expectThat(self.label).not_equals(u'', msg="Expected {0} label to contain text, but its empty".format(self.name)) |
420 | - expectThat(self.visible).equals(visible, |
421 | - msg="Expected {0} label to be visible, but its wasn't".format(self.name)) |
422 | + expectThat(self.label).not_equals( |
423 | + u'', |
424 | + msg="Expected {0} label to contain text, but its empty" |
425 | + .format(self.name)) |
426 | + expectThat(self.visible).equals( |
427 | + visible, |
428 | + msg="Expected {0} label to be visible, but its wasn't" |
429 | + .format(self.name)) |
430 | |
431 | def click(self, ): |
432 | """ Clicks a GtkToggleButton, |
433 | @@ -96,9 +108,9 @@ |
434 | new_val = 0 |
435 | if self.active == 0: |
436 | new_val = 1 |
437 | - logger.debug('Objects current state is "{0}", \ |
438 | - the state after clicking should be "{1}"'.format( |
439 | - self.active, new_val)) |
440 | + logger.debug('Objects current state is "{0}", ' |
441 | + 'the state after clicking should be "{1}"' |
442 | + .format(self.active, new_val)) |
443 | #now click it |
444 | self.pointing_device.click_object(self) |
445 | #now wait for state to change |
446 | @@ -134,14 +146,19 @@ |
447 | #now wait for state to change |
448 | self.active.wait_for(1) |
449 | logger.debug( |
450 | - 'Object clicked and and selected. Active state changed successfully') |
451 | + 'Object clicked and and selected. Active state changed ' |
452 | + 'successfully') |
453 | |
454 | def check(self, visible=True): |
455 | expectThat(self.label).is_unicode() |
456 | - expectThat(self.label).not_equals(u'', |
457 | - msg="Expected {0} label to contain text, but its empty".format(self.name)) |
458 | - expectThat(self.visible).equals(visible, |
459 | - msg="Expected {0} label to be visible, but its wasn't".format(self.name)) |
460 | + expectThat(self.label).not_equals( |
461 | + u'', |
462 | + msg="Expected {0} label to contain text, but its empty" |
463 | + .format(self.name)) |
464 | + expectThat(self.visible).equals( |
465 | + visible, |
466 | + msg="Expected {0} label to be visible, but its wasn't" |
467 | + .format(self.name)) |
468 | |
469 | |
470 | class GtkImage(AutopilotGtkEmulatorBase): |
471 | @@ -151,13 +168,15 @@ |
472 | |
473 | def check(self, visible=True, imageStock='gtk-yes'): |
474 | if visible: |
475 | - expectThat(self.visible).equals(visible, |
476 | - msg="Expected {0} label to be visible, but its wasn't".format(self.name)) |
477 | + expectThat(self.visible).equals( |
478 | + visible, |
479 | + msg="Expected {0} label to be visible, but its wasn't" |
480 | + .format(self.name)) |
481 | |
482 | - expectThat(self.stock).equals(imageStock, |
483 | - msg="Expected {0} image to have stock image {1} but instead it is {2}".format( |
484 | - self.name, imageStock, self.stock |
485 | - )) |
486 | + expectThat(self.stock).equals( |
487 | + imageStock, |
488 | + msg="Expected {0} image to have stock image {1} but instead " |
489 | + "it is {2}".format(self.name, imageStock, self.stock)) |
490 | |
491 | |
492 | class GtkTreeView(AutopilotGtkEmulatorBase): |
493 | @@ -189,16 +208,18 @@ |
494 | """ |
495 | logger.debug('Selecting "{0}" item'.format(labelText)) |
496 | try: |
497 | - #lets try and get the corresponding GailTreeView |
498 | - # so we can assure we are selecting the item from the correct treeview |
499 | + # lets try and get the corresponding GailTreeView so we can assure |
500 | + # we are selecting the item from the correct treeview |
501 | treeview = self._get_gail_treeview() |
502 | treeview_item = treeview.select_item(str(labelText)) |
503 | except ValueError: |
504 | - #lets catch the exception and have one last go at selecting the item from a root instance |
505 | + # lets catch the exception and have one last go at selecting the |
506 | + # item from a root instance |
507 | # This may return more than one though. |
508 | - logger.warning('Could not get corresponding GtkTreeViewAccessibleObject \ |
509 | - with globalRect {0}. Trying to select GtkTreeView item \ |
510 | - from root object instead'.format(self.globalRect)) |
511 | + logger.warning('Could not get corresponding ' |
512 | + 'GtkTreeViewAccessibleObject with globalRect {0}. ' |
513 | + 'Trying to select GtkTreeView item from root ' |
514 | + 'object instead'.format(self.globalRect)) |
515 | root = self.get_root_instance() |
516 | if root is None: |
517 | raise ValueError("Emulator could not get a root instance") |
518 | @@ -221,7 +242,8 @@ |
519 | treeview = self._get_gail_treeview() |
520 | treeview_item = treeview.select_item_by_index(index) |
521 | if treeview_item is None: |
522 | - raise ValueError("Could not select item with index '{0}'".format(index)) |
523 | + raise ValueError("Could not select item with index '{0}'" |
524 | + .format(index)) |
525 | return treeview_item |
526 | |
527 | def get_all_items(self, startWith=None): |
528 | @@ -233,13 +255,16 @@ |
529 | return items |
530 | |
531 | def _get_gail_treeview(self, ): |
532 | - """ Gets the GtkTreeViews corresponding GtkTreeViewAccessible object """ |
533 | + """ |
534 | + Gets the GtkTreeViews corresponding GtkTreeViewAccessible object |
535 | + """ |
536 | logger.debug('Getting corresponding GtkTreeViewAccessible object') |
537 | # lets get a root instance |
538 | root = self.get_root_instance() |
539 | assert root is not None |
540 | - # As the treeview item is in the GAILWindow tree and not our current tree |
541 | - # We want to select the treeviewaccessible with the same globalRect as us |
542 | + # As the treeview item is in the GAILWindow tree and not our current |
543 | + # tree We want to select the treeviewaccessible with the same |
544 | + # globalRect as us |
545 | logger.debug('Selecting GtkTreeViewAccessible with same globalRect') |
546 | treeviews = root.select_many('GtkTreeViewAccessible', |
547 | globalRect=self.globalRect) |
548 | @@ -247,7 +272,8 @@ |
549 | # same globalRect so lets pick out the one thats visible |
550 | for treeview in treeviews: |
551 | if treeview.visible: |
552 | - logger.debug('GtkTreeViewAccessible object found, returning object.') |
553 | + logger.debug('GtkTreeViewAccessible object found, ' |
554 | + 'returning object.') |
555 | return treeview |
556 | raise ValueError( |
557 | "No treeview visible with globalRect {0}".format(self.globalRect) |
558 | @@ -317,7 +343,8 @@ |
559 | self.kbd.press_and_release('Home') |
560 | self.kbd.press_and_release('Enter') |
561 | |
562 | - index = next((index for index, value in enumerate(items) if fsFormat == value.accessible_name), None) |
563 | + index = next((index for index, value in enumerate(items) |
564 | + if fsFormat == value.accessible_name), None) |
565 | |
566 | i = 0 |
567 | while True: |
568 | @@ -348,7 +375,8 @@ |
569 | class GtkComboBoxText(GtkComboBox): |
570 | """ Emulator class for a GtkComboBoxText instance |
571 | |
572 | - .. note:: see :func:`GtkComboBox`. `GtkComboBoxText` inherits from `GtkComboBox` |
573 | + .. note:: see :func:`GtkComboBox`. `GtkComboBoxText` inherits from |
574 | + `GtkComboBox` |
575 | |
576 | """ |
577 | def __init__(self, *args): |
578 | @@ -367,7 +395,10 @@ |
579 | def enter_value(self, value): |
580 | self._select_entry() |
581 | self.kbd.type(value) |
582 | - expectThat(self.text).equals(value, msg="Expected spinbutton value '{0}' to equal {1}".format(self.text, value)) |
583 | + expectThat(self.text).equals( |
584 | + value, |
585 | + msg="Expected spinbutton value '{0}' to equal {1}" |
586 | + .format(self.text, value)) |
587 | |
588 | def _select_entry(self, ): |
589 | self.pointing_device.move_to_object(self) |
590 | |
591 | === modified file 'autopilot/ubiquity_autopilot_tests/emulators/gtktoplevel.py' |
592 | --- autopilot/ubiquity_autopilot_tests/emulators/gtktoplevel.py 2013-11-12 19:27:27 +0000 |
593 | +++ autopilot/ubiquity_autopilot_tests/emulators/gtktoplevel.py 2013-11-19 09:56:21 +0000 |
594 | @@ -4,23 +4,27 @@ |
595 | # |
596 | # Author: Daniel Chapman daniel@chapman-mail.com |
597 | # |
598 | -# This program is free software; you can redistribute it and/or modify |
599 | -# it under the terms of the GNU Lesser General Public License as published by |
600 | -# the Free Software Foundation; version 3. |
601 | +# This program is free software; you can redistribute it and/or modify it under |
602 | +# the terms of the GNU Lesser General Public License as published by the Free |
603 | +# Software Foundation; version 3. |
604 | # |
605 | -# This program is distributed in the hope that it will be useful, |
606 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
607 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
608 | -# GNU Lesser General Public License for more details. |
609 | +# This program is distributed in the hope that it will be useful, but WITHOUT |
610 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
611 | +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
612 | +# details. |
613 | # |
614 | # You should have received a copy of the GNU Lesser General Public License |
615 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
616 | from autopilot.input import Pointer, Mouse, Keyboard |
617 | -from ubiquity_autopilot_tests.emulators import AutopilotGtkEmulatorBase, EmulatorException |
618 | +from ubiquity_autopilot_tests.emulators\ |
619 | + import AutopilotGtkEmulatorBase, EmulatorException |
620 | from ubiquity_autopilot_tests.tools.compare import expectThat |
621 | -from ubiquity_autopilot_tests.emulators.partconfig import Config1, Config2, Config3 |
622 | -from ubiquity_autopilot_tests.emulators.partconfig import Config4, Config5, Config6 |
623 | -from ubiquity_autopilot_tests.emulators import gtkcontrols, gtkaccessible, gtkcontainers |
624 | +from ubiquity_autopilot_tests.emulators.partconfig\ |
625 | + import Config1, Config2, Config3 |
626 | +from ubiquity_autopilot_tests.emulators.partconfig\ |
627 | + import Config4, Config5, Config6 |
628 | +from ubiquity_autopilot_tests.emulators\ |
629 | + import gtkcontrols, gtkaccessible, gtkcontainers |
630 | import time |
631 | import logging |
632 | logger = logging.getLogger(__name__) |
633 | @@ -31,8 +35,8 @@ |
634 | class GtkWindow(AutopilotGtkEmulatorBase): |
635 | """ Emulator class for a GtkWindow instance |
636 | |
637 | - You should use this class for the main window of the application under test. |
638 | - By importing this into your test and select it as a property:: |
639 | + You should use this class for the main window of the application under |
640 | + test. By importing this into your test and select it as a property:: |
641 | |
642 | from autopilotgtkemulators import gtktoplevel |
643 | |
644 | @@ -46,17 +50,21 @@ |
645 | def main_window(self, ): |
646 | return self.app.select_single(gtktoplevel.GtkWindow) |
647 | |
648 | - and now you can use self.main_window as our base for accessing all the objects within |
649 | - the Main application window. |
650 | - |
651 | - .. note:: When dealing with dialogs/windows spawned from the main application window |
652 | - use the :func:`get_dialog` to get an object of the spawned dialog/window :: |
653 | - |
654 | - >>> spawned_object = self.main_window.get_dialog('GtkDialog') |
655 | - |
656 | - and you can use keyword arguments if it returns more than one:: |
657 | - |
658 | - >>> spawned_object = self.main_window.get_dialog('GtkDialog', name='foo') |
659 | + and now you can use self.main_window as our base for accessing all the |
660 | + objects within the Main application window. |
661 | + |
662 | + .. note:: When dealing with dialogs/windows spawned from the main |
663 | + application window use the :func:`get_dialog` to get an |
664 | + object of the spawned dialog/window :: |
665 | + |
666 | + >>> spawned_object = self.main_window.get_dialog(\ |
667 | + 'GtkDialog') |
668 | + |
669 | + and you can use keyword arguments if it returns more than |
670 | + one:: |
671 | + |
672 | + >>> spawned_object = self.main_window.get_dialog(\ |
673 | + 'GtkDialog', name='foo') |
674 | """ |
675 | def __init__(self, *args): |
676 | |
677 | @@ -69,7 +77,8 @@ |
678 | |
679 | :param dialogType: Window type of the dialog e.g 'GtkDialog' |
680 | :rtype: a dialog object of the given dialogType |
681 | - :raises: **EmulatorException** if a root instance cannot be obtained |
682 | + :raises: **EmulatorException** if a root instance cannot be |
683 | + obtained |
684 | :raises: **ValueError** if the returned object is NoneType |
685 | """ |
686 | logger.debug('Getting root instance') |
687 | @@ -77,11 +86,13 @@ |
688 | if root is None: |
689 | raise EmulatorException("Emulator could not get root instance") |
690 | logger.debug( |
691 | - 'Root instance received, Now selecting "{0}" object'.format(dialogType)) |
692 | + 'Root instance received, Now selecting "{0}" object' |
693 | + .format(dialogType)) |
694 | dialog = root.select_single(dialogType, **kwargs) |
695 | if dialog is None: |
696 | raise ValueError( |
697 | - "Returned NoneType, could not select object of type {0}".format(dialogType)) |
698 | + "Returned NoneType, could not select object of type {0}" |
699 | + .format(dialogType)) |
700 | logger.debug('Returning {0} object'.format(dialogType)) |
701 | return dialog |
702 | |
703 | @@ -125,28 +136,35 @@ |
704 | while progress < complete: |
705 | #keep updating fraction value |
706 | progress = self.install_progress.fraction |
707 | - # lets sleep for a second on each loop until we get near the end of the progress bar |
708 | + # lets sleep for a second on each loop until we get near the end of |
709 | + # the progress bar |
710 | if progress < 0.7: |
711 | time.sleep(1) |
712 | |
713 | - logger.debug('Percentage complete "{0:.0f}%"'.format(progress * 100)) |
714 | + logger.debug('Percentage complete "{0:.0f}%"' |
715 | + .format(progress * 100)) |
716 | #check for install errors while waiting |
717 | try: |
718 | - crash_dialog = self.get_dialog('GtkDialog', BuilderName='crash_dialog') |
719 | + crash_dialog = self.get_dialog('GtkDialog', |
720 | + BuilderName='crash_dialog') |
721 | logger.debug("Checking crash dialog hasn't appeared....") |
722 | if crash_dialog.visibe: |
723 | logger.error("Crash Dialog appeared") |
724 | - assert not crash_dialog.visible, "Crash Dialog appeared! Something went wrong!!!" |
725 | + assert not crash_dialog.visible,\ |
726 | + "Crash Dialog appeared! Something went wrong!!!" |
727 | progress = 1.0 |
728 | except Exception: |
729 | pass |
730 | # Lets try and grab the grub failed message box on the fly |
731 | try: |
732 | - logger.debug("Checking failed grub install dialog hasn't appeared.......") |
733 | + logger.debug("Checking failed grub install dialog hasn't " |
734 | + "appeared.......") |
735 | grub_dialog = self.get_dialog('GtkMessageDialog') |
736 | if grub_dialog.visible: |
737 | - logger.error("The Grub installation failed dialog appeared :-(") |
738 | - assert grub_dialog.visible != 1, "The Grub installation failed" |
739 | + logger.error("The Grub installation failed dialog " |
740 | + "appeared :-(") |
741 | + assert grub_dialog.visible != 1,\ |
742 | + "The Grub installation failed" |
743 | progress = 1.0 |
744 | except Exception: |
745 | pass |
746 | @@ -162,7 +180,8 @@ |
747 | def set_partition_size(self, size=None): |
748 | """ Sets the size of the partition being created |
749 | |
750 | - :param size: Partition size in MB, if None will use rest of remaining space |
751 | + :param size: Partition size in MB, if None will use rest of remaining |
752 | + space |
753 | """ |
754 | logger.debug("set_partition_size({0})".format(str(size))) |
755 | if size: |
756 | @@ -197,7 +216,8 @@ |
757 | _partition_type = {'Primary': 'partition_create_type_primary', |
758 | 'Logical': 'partition_create_type_logical'} |
759 | part_type = _partition_type[pType] |
760 | - radiobutton = self.select_single('GtkRadioButton', BuilderName=part_type) |
761 | + radiobutton = self.select_single('GtkRadioButton', |
762 | + BuilderName=part_type) |
763 | radiobutton.click() |
764 | |
765 | def set_file_system_type(self, fsType): |
766 | @@ -222,27 +242,35 @@ |
767 | 'Nothing': 'do not use partition' |
768 | } |
769 | file_system = _file_system_type[fsType] |
770 | - combobox = self.select_single('GtkComboBox', BuilderName='partition_use_combo') |
771 | + combobox = self.select_single('GtkComboBox', |
772 | + BuilderName='partition_use_combo') |
773 | combobox.select_filesystem_format(file_system) |
774 | |
775 | def set_mount_point(self, mntPoint=None): |
776 | """ Sets the mount point for the partition """ |
777 | logger.debug("set_mount_point({0})".format(mntPoint)) |
778 | if mntPoint: |
779 | - combobox = self.select_single('GtkComboBox', BuilderName='partition_mount_combo') |
780 | + combobox = self.select_single('GtkComboBox', |
781 | + BuilderName='partition_mount_combo') |
782 | combobox.select_item(mntPoint, enter=False) |
783 | |
784 | return |
785 | |
786 | def check_dialog_objects(self, ): |
787 | - objects = ['partition_mount_combo', 'partition_use_combo', |
788 | - 'partition_create_type_primary', 'partition_create_type_logical', |
789 | - 'partition_create_place_beginning', 'partition_create_place_end', |
790 | + objects = ['partition_mount_combo', |
791 | + 'partition_use_combo', |
792 | + 'partition_create_type_primary', |
793 | + 'partition_create_type_logical', |
794 | + 'partition_create_place_beginning', |
795 | + 'partition_create_place_end', |
796 | ] |
797 | for name in objects: |
798 | obj = self.select_single(BuilderName=name) |
799 | obj.check() |
800 | - expectThat(self.visible).equals(True, msg='Partition Dialog was not visible') |
801 | + expectThat(self.visible).equals( |
802 | + True, |
803 | + msg='Partition Dialog was not visible') |
804 | + |
805 | |
806 | class GtkMessageDialog(GtkDialog): |
807 | """ Emulator class for a GtkMessageDialog, """ |
808 | |
809 | === modified file 'autopilot/ubiquity_autopilot_tests/emulators/partconfig.py' |
810 | --- autopilot/ubiquity_autopilot_tests/emulators/partconfig.py 2013-10-22 16:51:31 +0000 |
811 | +++ autopilot/ubiquity_autopilot_tests/emulators/partconfig.py 2013-11-19 09:56:21 +0000 |
812 | @@ -11,8 +11,9 @@ |
813 | 'PartitionSize': int, # an int value of size in MB If set to None, |
814 | we use up all remaining space |
815 | |
816 | + # These are the current available mount points |
817 | 'MountPoint': /, /boot, /home, |
818 | - /tmp, /usr, /var, # These are the current available mount points |
819 | + /tmp, /usr, /var, |
820 | /srv, /opt, /usr/local |
821 | |
822 | 'FileSystemType': 'Ext2','Ext3', 'Ext4', 'ReiserFs', |
823 | |
824 | === modified file 'autopilot/ubiquity_autopilot_tests/testcase.py' |
825 | --- autopilot/ubiquity_autopilot_tests/testcase.py 2013-11-12 19:35:59 +0000 |
826 | +++ autopilot/ubiquity_autopilot_tests/testcase.py 2013-11-19 09:56:21 +0000 |
827 | @@ -62,9 +62,11 @@ |
828 | %s |
829 | _______________________________________________________________________ |
830 | """ % error |
831 | - self.addDetail("Non-Fatal error {0}: ".format(num), text_content(output)) |
832 | + self.addDetail("Non-Fatal error {0}: ".format(num), |
833 | + text_content(output)) |
834 | num += 1 |
835 | - raise NonFatalErrors("{0} non fatal errors found during install".format(len(error_list))) |
836 | + raise NonFatalErrors("{0} non fatal errors found during install" |
837 | + .format(len(error_list))) |
838 | return |
839 | |
840 | def expectEqual(self, expected, observed, message=''): |
841 | @@ -78,7 +80,8 @@ |
842 | try: |
843 | self._expectThat(observed, matcher, message) |
844 | except MismatchError: |
845 | - logger.error("Expected %r to equal %r but it didn't" % expected, observed, exc_info=True) |
846 | + logger.error("Expected %r to equal %r but it didn't" % |
847 | + expected, observed, exc_info=True) |
848 | stck = traceback.format_exc(limit=5) |
849 | self.non_fatal_errors.append(stck) |
850 | |
851 | @@ -103,7 +106,8 @@ |
852 | try: |
853 | self._expectThat(obj, matcher, msg) |
854 | except MismatchError: |
855 | - logger.error("Expected %r to be instance of %r but it wasn't" % obj, klass, exc_info=True) |
856 | + logger.error("Expected %r to be instance of %r but it wasn't" % |
857 | + obj, klass, exc_info=True) |
858 | stck = traceback.format_exc(limit=5) |
859 | self.non_fatal_errors.append(stck) |
860 | |
861 | |
862 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/__init__.py' |
863 | --- autopilot/ubiquity_autopilot_tests/tests/__init__.py 2013-11-15 17:15:32 +0000 |
864 | +++ autopilot/ubiquity_autopilot_tests/tests/__init__.py 2013-11-19 09:56:21 +0000 |
865 | @@ -71,9 +71,9 @@ |
866 | ''' |
867 | my_process = int(os.environ['UBIQUITY_PID']) |
868 | my_dbus = str(os.environ['DBUS_SESSION_BUS_ADDRESS']) |
869 | - return get_proxy_object_for_existing_process(pid=my_process, |
870 | - dbus_bus=my_dbus, |
871 | - emulator_base=AutopilotGtkEmulatorBase) |
872 | + return get_proxy_object_for_existing_process( |
873 | + pid=my_process, dbus_bus=my_dbus, |
874 | + emulator_base=AutopilotGtkEmulatorBase) |
875 | |
876 | @property |
877 | def main_window(self, ): |
878 | @@ -96,15 +96,19 @@ |
879 | nxt_button.click() |
880 | |
881 | if wait: |
882 | - #This sleep just bridges a weird error when the next button, sometimes |
883 | - # flickers its sensitive property back to 1 once clicked and then |
884 | - # goes back to 0 |
885 | + # This sleep just bridges a weird error when the next button, |
886 | + # sometimes flickers its sensitive property back to 1 once clicked |
887 | + # and then goes back to 0 |
888 | time.sleep(2) |
889 | - # now take back over from the sleep and wait for sensitive to become 1 |
890 | - logger.debug("Waiting for 'next' Button to become sensitive again.....") |
891 | - self.assertThat(nxt_button.sensitive, Eventually(Equals(True), timeout=1200)) |
892 | + # now take back over from the sleep and wait for sensitive to |
893 | + # become 1 |
894 | + logger.debug("Waiting for 'next' Button to become sensitive " |
895 | + "again.....") |
896 | + self.assertThat(nxt_button.sensitive, |
897 | + Eventually(Equals(True), timeout=1200)) |
898 | |
899 | - page_title = self.main_window.select_single('GtkLabel', name='page_title') |
900 | + page_title = self.main_window.select_single( |
901 | + 'GtkLabel', name='page_title') |
902 | self.assertThat(page_title.label, |
903 | Eventually(NotEquals(self.current_page_title), |
904 | timeout=120)) |
905 | @@ -112,19 +116,23 @@ |
906 | def go_to_progress_page(self, ): |
907 | """ This simply clicks next and goes to the progress page |
908 | |
909 | - NOTE: THis shouldn't be used for any other page switches as it does no checks. |
910 | - |
911 | + NOTE: |
912 | + This shouldn't be used for any other page switches as it does no |
913 | + checks. |
914 | + |
915 | """ |
916 | nxt_button = self.main_window.select_single('GtkButton', name='next') |
917 | nxt_button.click() |
918 | |
919 | def welcome_page_tests(self, lang=None): |
920 | """ Runs the tests for the Welcome Page |
921 | - :param lang: The treeview label value (e.g 'English') of the required language. |
922 | + :param lang: The treeview label value (e.g 'English') of the required |
923 | + language. |
924 | If None will pick a random language from the tree. |
925 | - ..NOTE: You should only specify a language if the test relies |
926 | - upon a specific language. It is better to write the tests |
927 | - to work for any language. |
928 | + ..NOTE: You should only specify a language if the test |
929 | + relies upon a specific language. It is better to write |
930 | + the tests to work for any language. |
931 | + |
932 | """ |
933 | self._update_current_step('stepLanguage') |
934 | self._check_navigation_buttons() |
935 | @@ -132,19 +140,23 @@ |
936 | logger.debug("run_welcome_page_tests()") |
937 | #selecting an install language |
938 | logger.debug("Selecting stepLanguage page object") |
939 | - welcome_page = self.main_window.select_single('GtkBox', name='stepLanguage') |
940 | + welcome_page = self.main_window.select_single( |
941 | + 'GtkBox', name='stepLanguage') |
942 | treeview = welcome_page.select_single('GtkTreeView') |
943 | #lets get all items |
944 | treeview_items = treeview.get_all_items() |
945 | #first lets check all the items are non-empty unicode strings |
946 | logger.debug("Checking all tree items are valid unicode") |
947 | for item in treeview_items: |
948 | - logger.debug("Check tree item with name '%s' is unicode" % item.accessible_name) |
949 | + logger.debug("Check tree item with name '%s' is unicode" % |
950 | + item.accessible_name) |
951 | self.expectIsInstance(item.accessible_name, str, |
952 | - "[Page:'stepLanguage'] Expected '%s' tree view item to be unicode but it wasn't" |
953 | - % item.accessible_name) |
954 | + "[Page:'stepLanguage'] Expected '%s' tree " |
955 | + "view item to be unicode but it wasn't" % |
956 | + item.accessible_name) |
957 | self.expectThat(item.accessible_name, NotEquals(u''), |
958 | - "[Page:'stepLanguage'] Tree item found that doesn't contain any text") |
959 | + "[Page:'stepLanguage'] Tree item found that " |
960 | + "doesn't contain any text") |
961 | |
962 | if lang: |
963 | item = treeview.select_item(lang) |
964 | @@ -158,21 +170,26 @@ |
965 | self.assertThat(language.selected, Equals(True)) |
966 | ##Test release notes label is visible |
967 | logger.debug("Checking the release_notes_label") |
968 | - release_notes_label = welcome_page.select_single('GtkLabel', |
969 | - BuilderName='release_notes_label') |
970 | + release_notes_label = welcome_page.select_single( |
971 | + 'GtkLabel', BuilderName='release_notes_label') |
972 | self.expectThat(release_notes_label.visible, Equals(True), |
973 | - "[Page:'{0}'] Release notes label was not visible".format(self.current_step)) |
974 | + "[Page:'{0}'] Release notes label was not visible" |
975 | + .format(self.current_step)) |
976 | self.expectThat(release_notes_label.label, NotEquals(u''), |
977 | - "[Page:'{0}'] Release notes label did not contain any text".format(self.current_step)) |
978 | + "[Page:'{0}'] Release notes label did not contain " |
979 | + "any text".format(self.current_step)) |
980 | self.expectIsInstance(release_notes_label.label, str, |
981 | - "[Page:'{0}'] Expected release notes label to be unicode but it wasn't") |
982 | + "[Page:'{0}'] Expected release notes label to " |
983 | + "be unicode but it wasn't") |
984 | self.pointing_device.move_to_object(release_notes_label) |
985 | self._update_page_titles() |
986 | if self.english_install: |
987 | #if english install check english values |
988 | self.eng_config = eng_label_values.stepLanguage |
989 | - self.expectThat(release_notes_label.label, Equals(self.eng_config['release_notes_label'])) |
990 | - self.expectThat(self.current_page_title, Equals(self.eng_config['page_title'])) |
991 | + self.expectThat(release_notes_label.label, |
992 | + Equals(self.eng_config['release_notes_label'])) |
993 | + self.expectThat(self.current_page_title, |
994 | + Equals(self.eng_config['page_title'])) |
995 | self._check_page_titles() |
996 | self._check_navigation_buttons() |
997 | |
998 | @@ -183,22 +200,24 @@ |
999 | |
1000 | :param updates: Boolean, if True selects install updates during install |
1001 | |
1002 | - :param thirdParty: Boolean, if True selects install third-party software |
1003 | + :param thirdParty: Boolean, if True selects install third-party |
1004 | + software |
1005 | |
1006 | - :param networkConnection: Boolean if True checks the network state box is |
1007 | - visible and objects are correct, If false will |
1008 | - still check the objects are correct but the |
1009 | - state box is not visible |
1010 | + :param networkConnection: Boolean if True checks the network state box |
1011 | + is visible and objects are correct, If |
1012 | + false will still check the objects are |
1013 | + correct but the state box is not visible |
1014 | |
1015 | :param sufficientSpace: Boolean if True checks the network state box is |
1016 | - visible and objects are correct, If false will |
1017 | - still check the objects are correct but the |
1018 | - state box is not visible |
1019 | + visible and objects are correct, If false |
1020 | + will still check the objects are correct |
1021 | + but the state box is not visible |
1022 | |
1023 | :param powerSource: Boolean if True checks the network state box is |
1024 | - visible and objects are correct, If false will |
1025 | - still check the objects are correct but the |
1026 | - state box is not visible |
1027 | + visible and objects are correct, If false |
1028 | + will still check the objects are correct |
1029 | + but the state box is not visible |
1030 | + |
1031 | """ |
1032 | self._update_current_step('stepPrepare') |
1033 | self._check_navigation_buttons() |
1034 | @@ -206,7 +225,8 @@ |
1035 | |
1036 | logger.debug("run_preparing_page_tests()") |
1037 | logger.debug("selecting stepPrepare page") |
1038 | - preparing_page = self.main_window.select_single('GtkAlignment', BuilderName='stepPrepare') |
1039 | + preparing_page = self.main_window.select_single( |
1040 | + 'GtkAlignment', BuilderName='stepPrepare') |
1041 | |
1042 | objList = ['prepare_best_results', 'prepare_foss_disclaimer', |
1043 | 'prepare_download_updates', 'prepare_nonfree_software'] |
1044 | @@ -214,33 +234,32 @@ |
1045 | logging.debug("Running checks on {0} object".format(i)) |
1046 | obj = preparing_page.select_single(BuilderName=i) |
1047 | self.expectThat(obj.visible, Equals(True), |
1048 | - "[Page:'{0}'] Expected {1} object to be visible but it wasn't".format( |
1049 | - self.current_step, obj.name |
1050 | - )) |
1051 | + "[Page:'{0}'] Expected {1} object to be " |
1052 | + "visible but it wasn't" |
1053 | + .format(self.current_step, obj.name)) |
1054 | self.expectThat(obj.label, NotEquals(u''), |
1055 | - "[Page:'{0}'] Expected {1} objects label value to contain text but it didn't".format( |
1056 | - self.current_step, obj.name |
1057 | - )) |
1058 | + "[Page:'{0}'] Expected {1} objects label value " |
1059 | + "to contain text but it didn't" |
1060 | + .format(self.current_step, obj.name)) |
1061 | self.expectIsInstance(obj.label, str, |
1062 | - "[Page:'{0}'] Expected {1} objects label value to be unicode but it wasn't".format( |
1063 | - self.current_step, obj.name |
1064 | - )) |
1065 | + "[Page:'{0}'] Expected {1} objects label " |
1066 | + "value to be unicode but it wasn't" |
1067 | + .format(self.current_step, obj.name)) |
1068 | if self.english_install: |
1069 | #if english install check english values |
1070 | self.eng_config = eng_label_values.stepPrepare |
1071 | self.expectThat(obj.label, Equals(self.eng_config[i])) |
1072 | |
1073 | - |
1074 | if updates: |
1075 | logger.debug("Selecting install updates") |
1076 | - update_checkbutton = preparing_page.select_single('GtkCheckButton', |
1077 | - BuilderName='prepare_download_updates') |
1078 | + update_checkbutton = preparing_page.select_single( |
1079 | + 'GtkCheckButton', BuilderName='prepare_download_updates') |
1080 | self.pointing_device.click_object(update_checkbutton) |
1081 | |
1082 | if thirdParty: |
1083 | logger.debug("Selecting install thirdparty software") |
1084 | - thrdprty_checkbutton = preparing_page.select_single('GtkCheckButton', |
1085 | - BuilderName='prepare_nonfree_software') |
1086 | + thrdprty_checkbutton = preparing_page.select_single( |
1087 | + 'GtkCheckButton', BuilderName='prepare_nonfree_software') |
1088 | self.pointing_device.click_object(thrdprty_checkbutton) |
1089 | |
1090 | self._check_preparing_statebox('prepare_network_connection', |
1091 | @@ -254,7 +273,8 @@ |
1092 | |
1093 | self._check_page_titles() |
1094 | if self.english_install: |
1095 | - self.expectThat(self.current_page_title, Equals(self.eng_config['page_title'])) |
1096 | + self.expectThat(self.current_page_title, |
1097 | + Equals(self.eng_config['page_title'])) |
1098 | self._check_navigation_buttons() |
1099 | |
1100 | def edubuntu_addon_window_tests(self, ): |
1101 | @@ -264,24 +284,26 @@ |
1102 | self._update_current_step('edubuntu-addon_window') |
1103 | self._check_navigation_buttons() |
1104 | self._update_page_titles() |
1105 | - add_on_page = self.main_window.select_single('GtkVBox', BuilderName='edubuntu-addon_window') |
1106 | - page_objects = ['fallback_install', 'description', 'fallback_title', 'fallback_description', |
1107 | - 'ltsp_install', 'ltsp_title', 'ltsp_description', 'ltsp_interface_label'] |
1108 | + add_on_page = self.main_window.select_single( |
1109 | + 'GtkVBox', BuilderName='edubuntu-addon_window') |
1110 | + page_objects = ['fallback_install', 'description', 'fallback_title', |
1111 | + 'fallback_description', 'ltsp_install', 'ltsp_title', |
1112 | + 'ltsp_description', 'ltsp_interface_label'] |
1113 | |
1114 | for i in page_objects: |
1115 | obj = add_on_page.select_single(BuilderName=i) |
1116 | self.expectThat(obj.visible, Equals(True), |
1117 | - "[Page:'{0}'] Expected {1} object to be visible but it wasn't".format( |
1118 | - self.current_step, obj.name |
1119 | - )) |
1120 | + "[Page:'{0}'] Expected {1} object to be visible " |
1121 | + "but it wasn't" |
1122 | + .format(self.current_step, obj.name)) |
1123 | self.expectThat(obj.label, NotEquals(u''), |
1124 | - "[Page:'{0}'] Expected {1} objects label value to contain text but it didn't".format( |
1125 | - self.current_step, obj.name |
1126 | - )) |
1127 | + "[Page:'{0}'] Expected {1} objects label value " |
1128 | + "to contain text but it didn't" |
1129 | + .format(self.current_step, obj.name)) |
1130 | self.expectIsInstance(obj.label, str, |
1131 | - "[Page:'{0}'] Expected {1} objects label value to be unicode but it wasn't".format( |
1132 | - self.current_step, obj.name |
1133 | - )) |
1134 | + "[Page:'{0}'] Expected {1} objects label " |
1135 | + "value to be unicode but it wasn't" |
1136 | + .format(self.current_step, obj.name)) |
1137 | #if self.english_install: |
1138 | # #if english install check english values |
1139 | # self.eng_config = eng_label_values.stepPrepare |
1140 | @@ -289,7 +311,8 @@ |
1141 | #TODO: provide option to select different desktop |
1142 | self._check_page_titles() |
1143 | #if self.english_install: |
1144 | - # self.expectThat(self.current_page_title, Equals(self.eng_config['page_title'])) |
1145 | + # self.expectThat(self.current_page_title, |
1146 | + # Equals(self.eng_config['page_title'])) |
1147 | self._check_navigation_buttons() |
1148 | |
1149 | def edubuntu_packages_window_tests(self, ): |
1150 | @@ -299,20 +322,22 @@ |
1151 | self._update_current_step('edubuntu-packages_window') |
1152 | self._check_navigation_buttons() |
1153 | self._update_page_titles() |
1154 | - packages_page = self.main_window.select_single('GtkVBox', BuilderName='edubuntu-packages_window') |
1155 | - description = packages_page.select_single('GtkLabel', BuilderName='description') |
1156 | + packages_page = self.main_window.select_single( |
1157 | + 'GtkVBox', BuilderName='edubuntu-packages_window') |
1158 | + description = packages_page.select_single( |
1159 | + 'GtkLabel', BuilderName='description') |
1160 | self.expectThat(description.visible, Equals(True), |
1161 | - "[Page:'{0}'] Expected {1} object to be visible but it wasn't".format( |
1162 | - self.current_step, description.name |
1163 | - )) |
1164 | + "[Page:'{0}'] Expected {1} object to be visible but " |
1165 | + "it wasn't" |
1166 | + .format(self.current_step, description.name)) |
1167 | self.expectThat(description.label, NotEquals(u''), |
1168 | - "[Page:'{0}'] Expected {1} objects label value to contain text but it didn't".format( |
1169 | - self.current_step, description.name |
1170 | - )) |
1171 | + "[Page:'{0}'] Expected {1} objects label value to " |
1172 | + "contain text but it didn't" |
1173 | + .format(self.current_step, description.name)) |
1174 | self.expectIsInstance(description.label, str, |
1175 | - "[Page:'{0}'] Expected {1} objects label value to be unicode but it wasn't".format( |
1176 | - self.current_step, description.name |
1177 | - )) |
1178 | + "[Page:'{0}'] Expected {1} objects label " |
1179 | + "value to be unicode but it wasn't" |
1180 | + .format(self.current_step, description.name)) |
1181 | #if self.english_install: |
1182 | # #if english install check english values |
1183 | # self.eng_config = eng_label_values.stepPrepare |
1184 | @@ -321,23 +346,26 @@ |
1185 | |
1186 | self._check_page_titles() |
1187 | #if self.english_install: |
1188 | - # self.expectThat(self.current_page_title, Equals(self.eng_config['page_title'])) |
1189 | + # self.expectThat(self.current_page_title, |
1190 | + # Equals(self.eng_config['page_title'])) |
1191 | self._check_navigation_buttons() |
1192 | |
1193 | - def installation_type_page_tests(self, default=False, lvm=False, lvmEncrypt=False, custom=False): |
1194 | - """ Runs the tests for the installation type page |
1195 | + def installation_type_page_tests(self, default=False, lvm=False, |
1196 | + lvmEncrypt=False, custom=False): |
1197 | + """ |
1198 | + Runs the tests for the installation type page |
1199 | |
1200 | - :param default: Boolean if True will use the default selected option for the |
1201 | - installation |
1202 | + :param default: Boolean if True will use the default selected option |
1203 | + for the installation |
1204 | |
1205 | :param lvm: Boolean if True will use the LVM option for the |
1206 | - installation |
1207 | - |
1208 | - :param lvmEncrypt: Boolean if True will use the LVM with encryption option for the |
1209 | - installation |
1210 | - |
1211 | - :param custom: Boolean if True will use the 'Something else' option for the |
1212 | - installation |
1213 | + installation |
1214 | + |
1215 | + :param lvmEncrypt: Boolean if True will use the LVM with encryption |
1216 | + option for the installation |
1217 | + |
1218 | + :param custom: Boolean if True will use the 'Something else' option for |
1219 | + the installation |
1220 | |
1221 | """ |
1222 | self._update_current_step('stepPartAsk') |
1223 | @@ -365,30 +393,35 @@ |
1224 | config = custom_install |
1225 | option_name = 'custom_partitioning' |
1226 | self._options_tests(config.visible_options, config.hidden_options) |
1227 | - install_type_page = self.main_window.select_single('GtkAlignment', BuilderName='stepPartAsk') |
1228 | + install_type_page = self.main_window.select_single( |
1229 | + 'GtkAlignment', BuilderName='stepPartAsk') |
1230 | if option_name: |
1231 | obj = install_type_page.select_single(BuilderName=option_name) |
1232 | self.pointing_device.click_object(obj) |
1233 | |
1234 | self._check_page_titles() |
1235 | if self.english_install: |
1236 | - self.expectThat(self.current_page_title, Equals(self.eng_config['page_title'])) |
1237 | + self.expectThat(self.current_page_title, |
1238 | + Equals(self.eng_config['page_title'])) |
1239 | |
1240 | self._check_navigation_buttons() |
1241 | |
1242 | def lvm_crypto_page_tests(self, crypto_password): |
1243 | """ Runs the tests for the LVM encryption password page |
1244 | |
1245 | - :param crypto_password: *String*, password to be used for the encryption |
1246 | + :param crypto_password: *String*, password to be used for the |
1247 | + encryption |
1248 | |
1249 | """ |
1250 | self._update_current_step('stepPartCrypto') |
1251 | self._check_navigation_buttons() |
1252 | self._update_page_titles() |
1253 | |
1254 | - logger.debug("run_step_part_crypto_page_tests({0})".format(crypto_password)) |
1255 | + logger.debug("run_step_part_crypto_page_tests({0})" |
1256 | + .format(crypto_password)) |
1257 | logger.debug('Selecting stepPartCrypto page object') |
1258 | - crypto_page = self.main_window.select_single('GtkAlignment', BuilderName='stepPartCrypto') |
1259 | + crypto_page = self.main_window.select_single( |
1260 | + 'GtkAlignment', BuilderName='stepPartCrypto') |
1261 | |
1262 | items = ['verified_crypto_label', 'crypto_label', 'crypto_description', |
1263 | 'crypto_warning', 'crypto_extra_label', 'crypto_extra_time', |
1264 | @@ -396,17 +429,17 @@ |
1265 | for i in items: |
1266 | item = crypto_page.select_single(BuilderName=i) |
1267 | self.expectThat(item.visible, Equals(True), |
1268 | - "[Page:'{0}'] Expected {1} object to be visible but it wasn't".format( |
1269 | - self.current_step, item.name |
1270 | - )) |
1271 | + "[Page:'{0}'] Expected {1} object to be visible " |
1272 | + "but it wasn't" |
1273 | + .format(self.current_step, item.name)) |
1274 | self.expectThat(item.label, NotEquals(u''), |
1275 | - "[Page:'{0}'] Expected {1} objects label value to contain text but it didn't".format( |
1276 | - self.current_step, item.name |
1277 | - )) |
1278 | + "[Page:'{0}'] Expected {1} objects label value " |
1279 | + "to contain text but it didn't" |
1280 | + .format(self.current_step, item.name)) |
1281 | self.expectIsInstance(item.label, str, |
1282 | - "[Page:'{0}'] Expected {1} objects label value to be unicode but it wasn't".format( |
1283 | - self.current_step, item.name |
1284 | - )) |
1285 | + "[Page:'{0}'] Expected {1} objects label " |
1286 | + "value to be unicode but it wasn't" |
1287 | + .format(self.current_step, item.name)) |
1288 | if self.english_install: |
1289 | #if english install check english values |
1290 | self.eng_config = eng_label_values.stepPartCrypto |
1291 | @@ -415,7 +448,8 @@ |
1292 | crypto_page.enter_crypto_phrase(crypto_password) |
1293 | self._check_page_titles() |
1294 | if self.english_install: |
1295 | - self.expectThat(self.current_page_title, Equals(self.eng_config['page_title'])) |
1296 | + self.expectThat(self.current_page_title, |
1297 | + Equals(self.eng_config['page_title'])) |
1298 | |
1299 | self._check_navigation_buttons() |
1300 | |
1301 | @@ -425,7 +459,8 @@ |
1302 | The custom partition configurations are in partconfig.py. This function |
1303 | selects a random Config for each test run from partconfig.py. |
1304 | |
1305 | - When adding a new config, import it and add it to the custom_configs list |
1306 | + When adding a new config, import it and add it to the custom_configs |
1307 | + list |
1308 | |
1309 | :param part_config: |
1310 | """ |
1311 | @@ -434,17 +469,21 @@ |
1312 | self._update_page_titles() |
1313 | logger.debug("run_custom_partition_page_tests()") |
1314 | logger.debug("Selecting the stepPartAdvanced page object") |
1315 | - custom_page = self.main_window.select_single('GtkAlignment', BuilderName='stepPartAdvanced') |
1316 | + custom_page = self.main_window.select_single( |
1317 | + 'GtkAlignment', BuilderName='stepPartAdvanced') |
1318 | treeview = custom_page.select_single('GtkTreeView') |
1319 | self.expectThat(treeview.visible, Equals(True), |
1320 | "[Page:'{0}'] Partition tree view was not visible") |
1321 | - obj_list = ['partition_button_new', 'partition_button_delete', 'partition_button_edit', |
1322 | - 'partition_button_edit', 'partition_button_new_label'] |
1323 | + obj_list = ['partition_button_new', 'partition_button_delete', |
1324 | + 'partition_button_edit', 'partition_button_edit', |
1325 | + 'partition_button_new_label'] |
1326 | for name in obj_list: |
1327 | obj = custom_page.select_single(BuilderName=name) |
1328 | self.expectThat(obj.visible, Equals(True), |
1329 | - "[Page:'{0}'] {1} object was not visible".format(self.current_step, obj.name)) |
1330 | - logger.debug("Sleeping while we wait for all UI elements to fully load") |
1331 | + "[Page:'{0}'] {1} object was not visible" |
1332 | + .format(self.current_step, obj.name)) |
1333 | + logger.debug("Sleeping while we wait for all UI elements to fully " |
1334 | + "load") |
1335 | time.sleep(5) # need to give time for all UI elements to load |
1336 | custom_page.create_new_partition_table() |
1337 | #lets create the partitions from here |
1338 | @@ -457,7 +496,8 @@ |
1339 | for elem in config: |
1340 | self._add_new_partition() |
1341 | |
1342 | - partition_dialog = self.main_window.get_dialog('GtkDialog', BuilderName='partition_dialog') |
1343 | + partition_dialog = self.main_window.get_dialog( |
1344 | + 'GtkDialog', BuilderName='partition_dialog') |
1345 | self.assertThat(partition_dialog.visible, Eventually(Equals(True)), |
1346 | "Partition dialog not visible") |
1347 | partition_dialog.set_partition_size(elem['PartitionSize']) |
1348 | @@ -465,10 +505,11 @@ |
1349 | partition_dialog.set_partition_type(elem['PartitionType']) |
1350 | partition_dialog.set_file_system_type(elem['FileSystemType']) |
1351 | partition_dialog.set_mount_point(elem['MountPoint']) |
1352 | - ok_button = partition_dialog.select_single('GtkButton', |
1353 | - BuilderName='partition_dialog_okbutton') |
1354 | + ok_button = partition_dialog.select_single( |
1355 | + 'GtkButton', BuilderName='partition_dialog_okbutton') |
1356 | self.pointing_device.click_object(ok_button) |
1357 | - self.assertThat(partition_dialog.visible, Eventually(Equals(False)), |
1358 | + self.assertThat(partition_dialog.visible, |
1359 | + Eventually(Equals(False)), |
1360 | "Partition dialog did not close") |
1361 | self._check_partition_created(elem['MountPoint']) |
1362 | self._check_page_titles() |
1363 | @@ -488,11 +529,13 @@ |
1364 | self._update_page_titles() |
1365 | |
1366 | logger.debug("Selecting stepLocation page object") |
1367 | - location_page = self.main_window.select_single('GtkBox', BuilderName='stepLocation') |
1368 | + location_page = self.main_window.select_single( |
1369 | + 'GtkBox', BuilderName='stepLocation') |
1370 | location_map = location_page.select_single('CcTimezoneMap') |
1371 | self.assertThat(location_map.visible, Equals(True), |
1372 | "Expected location map to be visible but it wasn't") |
1373 | - location_entry = location_page.select_single(BuilderName='timezone_city_entry') |
1374 | + location_entry = location_page.select_single( |
1375 | + BuilderName='timezone_city_entry') |
1376 | self.assertThat(location_entry.visible, Equals(True), |
1377 | "Expected location entry to be visible but it wasn't") |
1378 | |
1379 | @@ -501,7 +544,8 @@ |
1380 | self._check_page_titles() |
1381 | if self.english_install: |
1382 | self.eng_config = eng_label_values.stepLocation |
1383 | - self.expectThat(self.current_page_title, Equals(self.eng_config['page_title'])) |
1384 | + self.expectThat(self.current_page_title, |
1385 | + Equals(self.eng_config['page_title'])) |
1386 | |
1387 | self._check_navigation_buttons(continue_button=True, back_button=True, |
1388 | quit_button=False, skip_button=False) |
1389 | @@ -514,43 +558,50 @@ |
1390 | logger.debug("run_keyboard_layout_page_tests()") |
1391 | |
1392 | logger.debug("Selecting the stepKeyboardCOnf page object") |
1393 | - keyboard_page = self.main_window.select_single('GtkAlignment', BuilderName='stepKeyboardConf') |
1394 | + keyboard_page = self.main_window.select_single( |
1395 | + 'GtkAlignment', |
1396 | + BuilderName='stepKeyboardConf') |
1397 | treeviews = keyboard_page.select_many('GtkTreeView') |
1398 | - #lets check all the keyboard tree items for the selected language |
1399 | + # lets check all the keyboard tree items for the selected language |
1400 | # TODO: we should probably test at some point try changing the keyboard |
1401 | - # layout to a different language/locale/layout and see if ubiquity breaks |
1402 | + # layout to a different language/locale/layout and see if |
1403 | + # ubiquity breaks |
1404 | for treeview in treeviews: |
1405 | items = treeview.get_all_items() |
1406 | for item in items: |
1407 | self.expectIsInstance(item.accessible_name, str, |
1408 | - "[Page:'%r'] Expected %r item to be unicode but it wasn't" % ( |
1409 | - self.current_step, item.accessible_name |
1410 | - )) |
1411 | + "[Page:'%r'] Expected %r item to be " |
1412 | + "unicode but it wasn't" % ( |
1413 | + self.current_step, |
1414 | + item.accessible_name)) |
1415 | self.expectThat(item.accessible_name, NotEquals(u''), |
1416 | - "[Page:'{0}'] Tree view item found which didn't contain text, but it should!!") |
1417 | + "[Page:'{0}'] Tree view item found which " |
1418 | + "didn't contain text, but it should!!") |
1419 | |
1420 | - #now lets test typing with the keyboard layout |
1421 | + # now lets test typing with the keyboard layout |
1422 | entry = keyboard_page.select_single('GtkEntry') |
1423 | with self.keyboard.focused_type(entry) as kb: |
1424 | kb.type(u'Testing keyboard layout') |
1425 | - #TODO: only test the entry value if we are using english install |
1426 | - #message = "Expected {0} (the length of the keyboard entry text) to be {1}".format( |
1427 | - # len(entry.text), len(u'Testing keyboard layout') |
1428 | - #) |
1429 | - #self.expectThat(len(entry.text), Equals(len(u'Testing keyboard layout'))) |
1430 | + # TODO: only test the entry value if we are using english install |
1431 | + #message = "Expected {0} (the length of the keyboard entry text) " |
1432 | + # " to be {1}" |
1433 | + # .format(len(entry.text), len(u'Testing keyboard layout')) |
1434 | + #self.expectThat(len(entry.text), Equals( |
1435 | + # len(u'Testing keyboard layout'))) |
1436 | self.expectThat(entry.text, NotEquals(u''), |
1437 | - "[Page:'{0}'] Expected Entry to contain text after typing but it didn't".format( |
1438 | - self.current_step |
1439 | - )) |
1440 | + "[Page:'{0}'] Expected Entry to contain text " |
1441 | + "after typing but it didn't" |
1442 | + .format(self.current_step)) |
1443 | self.expectIsInstance(entry.text, str, |
1444 | - "[Page:'{0}'] Expected Entry text to be unicode but it wasnt".format( |
1445 | - self.current_step |
1446 | - )) |
1447 | - #TODO: Test detecting keyboard layout |
1448 | + "[Page:'{0}'] Expected Entry text to be " |
1449 | + "unicode but it wasnt" |
1450 | + .format(self.current_step)) |
1451 | + # TODO: Test detecting keyboard layout |
1452 | self._check_page_titles() |
1453 | if self.english_install: |
1454 | self.eng_config = eng_label_values.stepKeyboardConf |
1455 | - self.expectThat(self.current_page_title, Equals(self.eng_config['page_title'])) |
1456 | + self.expectThat(self.current_page_title, Equals( |
1457 | + self.eng_config['page_title'])) |
1458 | |
1459 | self._check_navigation_buttons(continue_button=True, back_button=True, |
1460 | quit_button=False, skip_button=False) |
1461 | @@ -574,7 +625,9 @@ |
1462 | quit_button=False, skip_button=False) |
1463 | self._update_page_titles() |
1464 | logger.debug("Selecting stepUserInfo page") |
1465 | - user_info_page = self.main_window.select_single('GtkBox', BuilderName='stepUserInfo') |
1466 | + user_info_page = self.main_window.select_single( |
1467 | + 'GtkBox', |
1468 | + BuilderName='stepUserInfo') |
1469 | |
1470 | objects = ['hostname_label', 'username_label', 'password_label', |
1471 | 'verified_password_label', 'hostname_extra_label' |
1472 | @@ -583,17 +636,17 @@ |
1473 | for i in objects: |
1474 | obj = user_info_page.select_single('GtkLabel', name=i) |
1475 | self.expectThat(obj.visible, Equals(True), |
1476 | - "[Page:'{0}'] Expected {1} object to be visible but it wasn't".format( |
1477 | - self.current_step, obj.name |
1478 | - )) |
1479 | + "[Page:'{0}'] Expected {1} object to be visible " |
1480 | + "but it wasn't" |
1481 | + .format(self.current_step, obj.name)) |
1482 | self.expectThat(obj.label, NotEquals(u''), |
1483 | - "[Page:'{0}'] Expected {1} objects label value to contain text but it didn't".format( |
1484 | - self.current_step, obj.name |
1485 | - )) |
1486 | + "[Page:'{0}'] Expected {1} objects label value to " |
1487 | + "contain text but it didn't" |
1488 | + .format(self.current_step, obj.name)) |
1489 | self.expectIsInstance(obj.label, str, |
1490 | - "[Page:'{0}'] Expected {1} objects label value to be unicode but it wasn't".format( |
1491 | - self.current_step, obj.name |
1492 | - )) |
1493 | + "[Page:'{0}'] Expected {1} objects label " |
1494 | + "value to be unicode but it wasn't" |
1495 | + .format(self.current_step, obj.name)) |
1496 | if self.english_install: |
1497 | #if english install check english values |
1498 | self.eng_config = eng_label_values.stepUserInfo |
1499 | @@ -608,7 +661,8 @@ |
1500 | |
1501 | self._check_page_titles() |
1502 | if self.english_install: |
1503 | - self.expectThat(self.current_page_title, Equals(self.eng_config['page_title'])) |
1504 | + self.expectThat(self.current_page_title, |
1505 | + Equals(self.eng_config['page_title'])) |
1506 | |
1507 | self._check_navigation_buttons(continue_button=True, back_button=True, |
1508 | quit_button=False, skip_button=False) |
1509 | @@ -623,24 +677,28 @@ |
1510 | #TODO: add checks to the U1 page |
1511 | |
1512 | def progress_page_tests(self, ): |
1513 | - #TODO: move here from emulator and use process manager to check window stack doesn't change |
1514 | - # during the progress stage and if a dialog becomes top of stack we get |
1515 | - # window title to work outwhich one. Currently polling on dbus for two specific dialogs is really horrible |
1516 | + # TODO: move here from emulator and use process manager to check window |
1517 | + # stack doesn't change during the progress stage and if a dialog |
1518 | + # becomes top of stack we get window title to work outwhich one. |
1519 | + # Currently polling on dbus for two specific dialogs is really horrible |
1520 | # for the logs and test design so need to find a cleaner way. |
1521 | pass |
1522 | |
1523 | def _add_new_partition(self, ): |
1524 | """ adds a new partition """ |
1525 | logger.debug("_add_new_partition()") |
1526 | - custom_page = self.main_window.select_single('GtkAlignment', BuilderName='stepPartAdvanced') |
1527 | + custom_page = self.main_window.select_single( |
1528 | + 'GtkAlignment', |
1529 | + BuilderName='stepPartAdvanced') |
1530 | tree_view = custom_page.select_single('GtkTreeView') |
1531 | item = tree_view.select_item(u' free space') |
1532 | self.pointing_device.click_object(item) |
1533 | self.assertThat(item.selected, Equals(True), |
1534 | - "[Page:'{0}'] Free Space tree item not selected".format( |
1535 | - self.current_step |
1536 | - )) |
1537 | - add_button = custom_page.select_single('GtkToolButton', BuilderName='partition_button_new') |
1538 | + "[Page:'{0}'] Free Space tree item not selected" |
1539 | + .format(self.current_step)) |
1540 | + add_button = custom_page.select_single( |
1541 | + 'GtkToolButton', |
1542 | + BuilderName='partition_button_new') |
1543 | self.pointing_device.click_object(add_button) |
1544 | time.sleep(2) |
1545 | logger.debug('_add_new_partition complete') |
1546 | @@ -649,17 +707,19 @@ |
1547 | """ Checks that the partition was created properly """ |
1548 | time.sleep(5) |
1549 | # TODO: This needs fixing |
1550 | - custom_page = self.main_window.select_single('GtkAlignment', BuilderName='stepPartAdvanced') |
1551 | + custom_page = self.main_window.select_single( |
1552 | + 'GtkAlignment', |
1553 | + BuilderName='stepPartAdvanced') |
1554 | tree_view = custom_page.select_single('GtkTreeView') |
1555 | items = tree_view.get_all_items() |
1556 | print('partition_tree_items') |
1557 | - print('--------------------------------------------------------------') |
1558 | + print('-' * 78) |
1559 | for item in items: |
1560 | if item.accessible_name == u'': |
1561 | print('empty item ------------') |
1562 | else: |
1563 | print(item.accessible_name) |
1564 | - print('-----------------------------------------------------------------') |
1565 | + print('-' * 78) |
1566 | |
1567 | #root = self.get_root_instance() |
1568 | #item = root.select_single('GtkTextCellAccessible', |
1569 | @@ -699,104 +759,119 @@ |
1570 | |
1571 | def _update_page_titles(self, ): |
1572 | self.previous_page_title = self.current_page_title |
1573 | - self.current_page_title = self.main_window.select_single('GtkLabel', |
1574 | - BuilderName='page_title').label |
1575 | + self.current_page_title = self.main_window.select_single( |
1576 | + 'GtkLabel', |
1577 | + BuilderName='page_title').label |
1578 | |
1579 | def _check_page_titles(self, ): |
1580 | - current_page_title = self.main_window.select_single('GtkLabel', |
1581 | - BuilderName='page_title') |
1582 | - message_one = "Expected %s page title '%s' to not equal \ |
1583 | - the previous %s page title '%s' but it does" % \ |
1584 | - (self.current_step, self.current_page_title, self.step_before, self.previous_page_title) |
1585 | + current_page_title = self.main_window.select_single( |
1586 | + 'GtkLabel', |
1587 | + BuilderName='page_title') |
1588 | + message_one = "Expected %s page title '%s' to not equal the "\ |
1589 | + "previous %s page title '%s' but it does" % ( |
1590 | + self.current_step, self.current_page_title, |
1591 | + self.step_before, self.previous_page_title) |
1592 | |
1593 | - self.expectThat(self.previous_page_title, NotEquals(self.current_page_title), message=message_one) |
1594 | - # THis second one catches the known bug for the stepPartAdvanced page title switching back to the prev page title |
1595 | - message_two = "Expected %s page title '%s' to not equal the previous %s page title '%s' but it does" % \ |
1596 | - (self.current_step, current_page_title.label, self.step_before, self.previous_page_title) |
1597 | - #This only runs if the current page title changes from its initial value when page loaded |
1598 | + self.expectThat(self.previous_page_title, |
1599 | + NotEquals(self.current_page_title), |
1600 | + message=message_one) |
1601 | + # This second one catches the known bug for the stepPartAdvanced page |
1602 | + # title switching back to the prev page title |
1603 | + message_two = "Expected %s page title '%s' to not equal the previous "\ |
1604 | + "%s page title '%s' but it does" % ( |
1605 | + self.current_step, current_page_title.label, |
1606 | + self.step_before, self.previous_page_title) |
1607 | + # This only runs if the current page title changes from its initial |
1608 | + # value when page loaded |
1609 | if current_page_title.label != self.current_page_title: |
1610 | self.expectThat(self.previous_page_title, |
1611 | - NotEquals(current_page_title.label), message=message_two) |
1612 | + NotEquals(current_page_title.label), |
1613 | + message=message_two) |
1614 | self.expectThat(current_page_title.visible, Equals(True), |
1615 | - "[Page:'{0}'] Expect page title to be visible but it wasn't".format( |
1616 | - self.current_step |
1617 | - )) |
1618 | + "[Page:'{0}'] Expect page title to be visible but " |
1619 | + "it wasn't".format(self.current_step)) |
1620 | |
1621 | - def _check_preparing_statebox(self, stateboxName, visible=True, imagestock='gtk-yes'): |
1622 | + def _check_preparing_statebox(self, stateboxName, visible=True, |
1623 | + imagestock='gtk-yes'): |
1624 | """ Checks the preparing page statebox's """ |
1625 | logger.debug("Running checks on {0} StateBox".format(stateboxName)) |
1626 | - preparing_page = self.main_window.select_single('GtkAlignment', BuilderName='stepPrepare') |
1627 | - state_box = preparing_page.select_single('StateBox', BuilderName=stateboxName) |
1628 | + preparing_page = self.main_window.select_single( |
1629 | + 'GtkAlignment', BuilderName='stepPrepare') |
1630 | + state_box = preparing_page.select_single( |
1631 | + 'StateBox', BuilderName=stateboxName) |
1632 | logger.debug('check({0}, {1})'.format(visible, imagestock)) |
1633 | logger.debug("Running checks.......") |
1634 | if visible: |
1635 | self.expectThat(state_box.visible, Equals(visible), |
1636 | - "StateBox.check(): Expected {0} statebox to be visible but it wasn't".format( |
1637 | - state_box.name)) |
1638 | + "StateBox.check(): Expected {0} statebox to be " |
1639 | + "visible but it wasn't" |
1640 | + .format(state_box.name)) |
1641 | label = state_box.select_single('GtkLabel') |
1642 | self.expectThat(label.label, NotEquals(u''), |
1643 | - "[Page:'{0}'] Expected {1} Statebox's label to contain text but it didn't".format( |
1644 | - self.current_step, stateboxName |
1645 | - )) |
1646 | + "[Page:'{0}'] Expected {1} Statebox's label to " |
1647 | + "contain text but it didn't" |
1648 | + .format(self.current_step, stateboxName)) |
1649 | self.expectThat(label.visible, Equals(visible), |
1650 | - "[Page:'{0}'] Expected {1} Statebox label's visible property to be {2} ".format( |
1651 | - self.current_step, stateboxName, str(visible) |
1652 | - )) |
1653 | + "[Page:'{0}'] Expected {1} Statebox label's " |
1654 | + "visible property to be {2} " |
1655 | + .format(self.current_step, stateboxName, |
1656 | + str(visible))) |
1657 | self.expectIsInstance(label.label, str, |
1658 | - "[Page:'{0}'] Expected {1} Statebox's label to be unicode but it wasn't".format( |
1659 | - self.current_step, stateboxName |
1660 | - )) |
1661 | + "[Page:'{0}'] Expected {1} Statebox's label " |
1662 | + "to be unicode but it wasn't" |
1663 | + .format(self.current_step, stateboxName)) |
1664 | image = state_box.select_single('GtkImage') |
1665 | self.expectThat(image.stock, Equals(imagestock)) |
1666 | self.expectThat(image.visible, Equals(visible)) |
1667 | |
1668 | else: |
1669 | self.expectThat(state_box.visible, Equals(False), |
1670 | - "[Page:'{0}'] Expected {1} statebox to not be visible but it was".format( |
1671 | - self.current_step, stateboxName |
1672 | - )) |
1673 | + "[Page:'{0}'] Expected {1} statebox to not be " |
1674 | + "visible but it was" |
1675 | + .format(self.current_step, stateboxName)) |
1676 | |
1677 | def _options_tests(self, visible=[], hidden=[]): |
1678 | |
1679 | - install_type_page = self.main_window.select_single('GtkAlignment', BuilderName='stepPartAsk') |
1680 | + install_type_page = self.main_window.select_single( |
1681 | + 'GtkAlignment', |
1682 | + BuilderName='stepPartAsk') |
1683 | |
1684 | for option in visible: |
1685 | logger.info("selecting Visible object'{0}'".format(option)) |
1686 | opt = install_type_page.select_single(BuilderName=option) |
1687 | self.expectThat(opt.visible, Equals(True), |
1688 | - "[Page:'{0}'] Expected {1} object to be visible but it wasn't".format( |
1689 | - self.current_step, opt.name |
1690 | - )) |
1691 | + "[Page:'{0}'] Expected {1} object to be visible " |
1692 | + "but it wasn't" |
1693 | + .format(self.current_step, opt.name)) |
1694 | self.expectThat(opt.label, NotEquals(u''), |
1695 | - "[Page:'{0}'] Expected {1} objects label value to contain text but it didn't".format( |
1696 | - self.current_step, opt.name |
1697 | - )) |
1698 | + "[Page:'{0}'] Expected {1} objects label value to " |
1699 | + "contain text but it didn't" |
1700 | + .format(self.current_step, opt.name)) |
1701 | self.expectIsInstance(opt.label, str, |
1702 | - "[Page:'{0}'] Expected {1} objects label value to be unicode but it wasn't".format( |
1703 | - self.current_step, opt.name |
1704 | - )) |
1705 | + "[Page:'{0}'] Expected {1} objects label " |
1706 | + "value to be unicode but it wasn't" |
1707 | + .format(self.current_step, opt.name)) |
1708 | if self.english_install: |
1709 | #if english install check english values |
1710 | self.eng_config = eng_label_values.stepPartAsk |
1711 | self.expectThat(opt.label, Equals(self.eng_config[option])) |
1712 | |
1713 | - |
1714 | for option in hidden: |
1715 | logger.info("Selecting hidden object '{0}'".format(option)) |
1716 | |
1717 | opt = install_type_page.select_single(BuilderName=option) |
1718 | self.expectThat(opt.visible, Equals(False), |
1719 | - "[Page:'{0}'] Expected {1} object to be not visible but it was".format( |
1720 | - self.current_step, opt.name |
1721 | - )) |
1722 | + "[Page:'{0}'] Expected {1} object to be not " |
1723 | + "visible but it was" |
1724 | + .format(self.current_step, opt.name)) |
1725 | self.expectThat(opt.label, NotEquals(u''), |
1726 | - "[Page:'{0}'] Expected {1} objects label value to contain text but it didn't".format( |
1727 | - self.current_step, opt.name |
1728 | - )) |
1729 | + "[Page:'{0}'] Expected {1} objects label value to " |
1730 | + "contain text but it didn't" |
1731 | + .format(self.current_step, opt.name)) |
1732 | self.expectIsInstance(opt.label, str, |
1733 | - "[Page:'{0}'] Expected {1} objects label value to be unicode but it wasn't".format( |
1734 | - self.current_step, opt.name |
1735 | - )) |
1736 | + "[Page:'{0}'] Expected {1} objects label " |
1737 | + "value to be unicode but it wasn't" |
1738 | + .format(self.current_step, opt.name)) |
1739 | |
1740 | def _select_install_type(self, install_type): |
1741 | pass |
1742 | |
1743 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_custom_install.py' |
1744 | --- autopilot/ubiquity_autopilot_tests/tests/test_custom_install.py 2013-11-15 17:10:36 +0000 |
1745 | +++ autopilot/ubiquity_autopilot_tests/tests/test_custom_install.py 2013-11-19 09:56:21 +0000 |
1746 | @@ -13,6 +13,7 @@ |
1747 | # |
1748 | # You should have received a copy of the GNU General Public License |
1749 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1750 | + |
1751 | from ubiquity_autopilot_tests.tests import UbiquityAutopilotTestCase |
1752 | from testtools.matchers import Equals |
1753 | from autopilot.matchers import Eventually |
1754 | @@ -23,7 +24,9 @@ |
1755 | |
1756 | |
1757 | class CustomInstallTestCase(UbiquityAutopilotTestCase): |
1758 | - """ Custom install testcase installs *buntu flavor with custom partition setup """ |
1759 | + """ |
1760 | + Custom install testcase installs *buntu flavor with custom partition setup |
1761 | + """ |
1762 | |
1763 | def test_custom_install(self, ): |
1764 | #first check we have an emulator instance |
1765 | @@ -61,11 +64,14 @@ |
1766 | self.go_to_progress_page() |
1767 | |
1768 | self.main_window.run_install_progress_page_tests() |
1769 | - self.assertThat(lambda: self.app.select_single('GtkDialog', name='finished_dialog').visible, |
1770 | - Eventually(Equals(True))) |
1771 | + self.assertThat(lambda: self.app.select_single( |
1772 | + 'GtkDialog', |
1773 | + name='finished_dialog').visible, |
1774 | + Eventually(Equals(True))) |
1775 | #XXX: Uncomment if you want to restart after install complete |
1776 | - ##we need to sleep here to wait for dialog to fully load. It appears in dbus |
1777 | - ## before its actually visible. As the test has already passed this doesn't affect outcome |
1778 | + ## we need to sleep here to wait for dialog to fully load. It appears |
1779 | + ## in dbus before its actually visible. As the test has already passed |
1780 | + ## this doesn't affect outcome |
1781 | #time.sleep(5) |
1782 | # |
1783 | #self.keyboard.press_and_release('Enter') |
1784 | |
1785 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_english_default.py' |
1786 | --- autopilot/ubiquity_autopilot_tests/tests/test_english_default.py 2013-11-15 17:10:36 +0000 |
1787 | +++ autopilot/ubiquity_autopilot_tests/tests/test_english_default.py 2013-11-19 09:56:21 +0000 |
1788 | @@ -20,8 +20,10 @@ |
1789 | |
1790 | |
1791 | class EnglishDefaultInstallTestCase(UbiquityAutopilotTestCase): |
1792 | - """ A default install testcase just generally clicks through the installer |
1793 | - using all the default values """ |
1794 | + """ |
1795 | + A default install testcase just generally clicks through the installer |
1796 | + using all the default values |
1797 | + """ |
1798 | |
1799 | def test_default_install(self, ): |
1800 | #first check we have an emulator instance |
1801 | @@ -52,11 +54,14 @@ |
1802 | self.go_to_progress_page() |
1803 | |
1804 | self.main_window.run_install_progress_page_tests() |
1805 | - self.assertThat(lambda: self.app.select_single('GtkDialog', name='finished_dialog').visible, |
1806 | - Eventually(Equals(True))) |
1807 | + self.assertThat(lambda: self.app.select_single( |
1808 | + 'GtkDialog', |
1809 | + name='finished_dialog').visible, |
1810 | + Eventually(Equals(True))) |
1811 | #XXX: Uncomment if you want to restart after install complete |
1812 | - ##we need to sleep here to wait for dialog to fully load. It appears in dbus |
1813 | - ## before its actually visible. As the test has already passed this doesn't affect outcome |
1814 | + ## we need to sleep here to wait for dialog to fully load. It appears |
1815 | + ## in dbus before its actually visible. As the test has already passed |
1816 | + ## this doesn't affect outcome |
1817 | #time.sleep(5) |
1818 | # |
1819 | #self.keyboard.press_and_release('Enter') |
1820 | |
1821 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_english_encrypt_lvm.py' |
1822 | --- autopilot/ubiquity_autopilot_tests/tests/test_english_encrypt_lvm.py 2013-11-15 17:10:36 +0000 |
1823 | +++ autopilot/ubiquity_autopilot_tests/tests/test_english_encrypt_lvm.py 2013-11-19 09:56:21 +0000 |
1824 | @@ -20,7 +20,10 @@ |
1825 | |
1826 | |
1827 | class EnglishLVMEncryptInstallTestCase(UbiquityAutopilotTestCase): |
1828 | - """ LVMEncrypt install testcase installs *buntu flavor with LVM-encrypt partition setup """ |
1829 | + """ |
1830 | + LVMEncrypt install testcase installs *buntu flavor with LVM-encrypt |
1831 | + partition setup |
1832 | + """ |
1833 | |
1834 | def test_lvm_encrypt_install(self, ): |
1835 | #first check we have an emulator instance |
1836 | @@ -52,11 +55,14 @@ |
1837 | self.go_to_progress_page() |
1838 | |
1839 | self.main_window.run_install_progress_page_tests() |
1840 | - self.assertThat(lambda: self.app.select_single('GtkDialog', name='finished_dialog').visible, |
1841 | - Eventually(Equals(True))) |
1842 | + self.assertThat(lambda: self.app.select_single( |
1843 | + 'GtkDialog', |
1844 | + name='finished_dialog').visible, |
1845 | + Eventually(Equals(True))) |
1846 | #XXX: Uncomment if you want to restart after install complete |
1847 | - ##we need to sleep here to wait for dialog to fully load. It appears in dbus |
1848 | - ## before its actually visible. As the test has already passed this doesn't affect outcome |
1849 | + ## we need to sleep here to wait for dialog to fully load. It appears |
1850 | + ## in dbus before its actually visible. As the test has already passed |
1851 | + ## this doesn't affect outcome |
1852 | #time.sleep(5) |
1853 | # |
1854 | #self.keyboard.press_and_release('Enter') |
1855 | |
1856 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_english_lvm.py' |
1857 | --- autopilot/ubiquity_autopilot_tests/tests/test_english_lvm.py 2013-11-15 17:10:36 +0000 |
1858 | +++ autopilot/ubiquity_autopilot_tests/tests/test_english_lvm.py 2013-11-19 09:56:21 +0000 |
1859 | @@ -20,7 +20,9 @@ |
1860 | |
1861 | |
1862 | class EnglishLVMInstallTestCase(UbiquityAutopilotTestCase): |
1863 | - """ LVM install testcase installs *buntu flavor with LVM partition setup """ |
1864 | + """ |
1865 | + LVM install testcase installs *buntu flavor with LVM partition setup |
1866 | + """ |
1867 | |
1868 | def test_lvm_install(self, ): |
1869 | #first check we have an emulator instance |
1870 | @@ -51,11 +53,14 @@ |
1871 | self.go_to_progress_page() |
1872 | |
1873 | self.main_window.run_install_progress_page_tests() |
1874 | - self.assertThat(lambda: self.app.select_single('GtkDialog', name='finished_dialog').visible, |
1875 | - Eventually(Equals(True))) |
1876 | + self.assertThat(lambda: self.app.select_single( |
1877 | + 'GtkDialog', |
1878 | + name='finished_dialog').visible, |
1879 | + Eventually(Equals(True))) |
1880 | #XXX: Uncomment if you want to restart after install complete |
1881 | - ##we need to sleep here to wait for dialog to fully load. It appears in dbus |
1882 | - ## before its actually visible. As the test has already passed this doesn't affect outcome |
1883 | + ## we need to sleep here to wait for dialog to fully load. It appears |
1884 | + ## in dbus before its actually visible. As the test has already passed |
1885 | + ## this doesn't affect outcome |
1886 | #time.sleep(5) |
1887 | # |
1888 | #self.keyboard.press_and_release('Enter') |
1889 | |
1890 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_default.py' |
1891 | --- autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_default.py 2013-11-15 17:10:36 +0000 |
1892 | +++ autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_default.py 2013-11-19 09:56:21 +0000 |
1893 | @@ -20,8 +20,10 @@ |
1894 | |
1895 | |
1896 | class DefaultInstallTestCase(UbiquityAutopilotTestCase): |
1897 | - """ A default install testcase just generally clicks through the installer |
1898 | - using all the default values """ |
1899 | + """ |
1900 | + A default install testcase just generally clicks through the installer |
1901 | + using all the default values |
1902 | + """ |
1903 | |
1904 | def test_default_install(self, ): |
1905 | #first check we have an emulator instance |
1906 | @@ -52,11 +54,14 @@ |
1907 | self.go_to_progress_page() |
1908 | |
1909 | self.main_window.run_install_progress_page_tests() |
1910 | - self.assertThat(lambda: self.app.select_single('GtkDialog', name='finished_dialog').visible, |
1911 | - Eventually(Equals(True))) |
1912 | + self.assertThat(lambda: self.app.select_single( |
1913 | + 'GtkDialog', |
1914 | + name='finished_dialog').visible, |
1915 | + Eventually(Equals(True))) |
1916 | #XXX: Uncomment if you want to restart after install complete |
1917 | - ##we need to sleep here to wait for dialog to fully load. It appears in dbus |
1918 | - ## before its actually visible. As the test has already passed this doesn't affect outcome |
1919 | + ## we need to sleep here to wait for dialog to fully load. It appears |
1920 | + ## in dbus before its actually visible. As the test has already passed |
1921 | + ## this doesn't affect outcome |
1922 | #time.sleep(5) |
1923 | # |
1924 | #self.keyboard.press_and_release('Enter') |
1925 | |
1926 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_encrypt_lvm.py' |
1927 | --- autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_encrypt_lvm.py 2013-11-15 17:10:36 +0000 |
1928 | +++ autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_encrypt_lvm.py 2013-11-19 09:56:21 +0000 |
1929 | @@ -20,7 +20,10 @@ |
1930 | |
1931 | |
1932 | class LVMEncryptInstallTestCase(UbiquityAutopilotTestCase): |
1933 | - """ LVMEncrypt install testcase installs *buntu flavor with LVM-encrypt partition setup """ |
1934 | + """ |
1935 | + LVMEncrypt install testcase installs *buntu flavor with LVM-encrypt |
1936 | + partition setup |
1937 | + """ |
1938 | |
1939 | def test_lvm_encrypt_install(self, ): |
1940 | #first check we have an emulator instance |
1941 | @@ -53,11 +56,14 @@ |
1942 | self.go_to_progress_page() |
1943 | |
1944 | self.main_window.run_install_progress_page_tests() |
1945 | - self.assertThat(lambda: self.app.select_single('GtkDialog', name='finished_dialog').visible, |
1946 | - Eventually(Equals(True))) |
1947 | + self.assertThat(lambda: self.app.select_single( |
1948 | + 'GtkDialog', |
1949 | + name='finished_dialog').visible, |
1950 | + Eventually(Equals(True))) |
1951 | #XXX: Uncomment if you want to restart after install complete |
1952 | - ##we need to sleep here to wait for dialog to fully load. It appears in dbus |
1953 | - ## before its actually visible. As the test has already passed this doesn't affect outcome |
1954 | + ## we need to sleep here to wait for dialog to fully load. It appears |
1955 | + ## in dbus before its actually visible. As the test has already passed |
1956 | + ## this doesn't affect outcome |
1957 | #time.sleep(5) |
1958 | # |
1959 | #self.keyboard.press_and_release('Enter') |
1960 | |
1961 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_lvm.py' |
1962 | --- autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_lvm.py 2013-11-15 17:10:36 +0000 |
1963 | +++ autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_lvm.py 2013-11-19 09:56:21 +0000 |
1964 | @@ -20,7 +20,9 @@ |
1965 | |
1966 | |
1967 | class LVMInstallTestCase(UbiquityAutopilotTestCase): |
1968 | - """ LVM install testcase installs *buntu flavor with LVM partition setup """ |
1969 | + """ |
1970 | + LVM install testcase installs *buntu flavor with LVM partition setup |
1971 | + """ |
1972 | |
1973 | def test_lvm_install(self, ): |
1974 | #first check we have an emulator instance |
1975 | @@ -51,11 +53,14 @@ |
1976 | self.go_to_progress_page() |
1977 | |
1978 | self.main_window.run_install_progress_page_tests() |
1979 | - self.assertThat(lambda: self.app.select_single('GtkDialog', name='finished_dialog').visible, |
1980 | - Eventually(Equals(True))) |
1981 | + self.assertThat(lambda: self.app.select_single( |
1982 | + 'GtkDialog', |
1983 | + name='finished_dialog').visible, |
1984 | + Eventually(Equals(True))) |
1985 | #XXX: Uncomment if you want to restart after install complete |
1986 | - ##we need to sleep here to wait for dialog to fully load. It appears in dbus |
1987 | - ## before its actually visible. As the test has already passed this doesn't affect outcome |
1988 | + ## we need to sleep here to wait for dialog to fully load. It appears |
1989 | + ## in dbus before its actually visible. As the test has already passed |
1990 | + ## this doesn't affect outcome |
1991 | #time.sleep(5) |
1992 | # |
1993 | #self.keyboard.press_and_release('Enter') |
1994 | |
1995 | === modified file 'autopilot/ubiquity_autopilot_tests/tools/_exc.py' |
1996 | --- autopilot/ubiquity_autopilot_tests/tools/_exc.py 2013-11-01 14:28:55 +0000 |
1997 | +++ autopilot/ubiquity_autopilot_tests/tools/_exc.py 2013-11-19 09:56:21 +0000 |
1998 | @@ -3,4 +3,4 @@ |
1999 | |
2000 | class NonFatalErrors(AssertionError): |
2001 | """ Exception class for raising non fatal errors |
2002 | - """ |
2003 | \ No newline at end of file |
2004 | + """ |
2005 | |
2006 | === modified file 'autopilot/ubiquity_autopilot_tests/tools/compare.py' |
2007 | --- autopilot/ubiquity_autopilot_tests/tools/compare.py 2013-11-12 12:02:36 +0000 |
2008 | +++ autopilot/ubiquity_autopilot_tests/tools/compare.py 2013-11-19 09:56:21 +0000 |
2009 | @@ -29,26 +29,26 @@ |
2010 | |
2011 | |
2012 | class expectThat(object): |
2013 | - """ expectThat is a tool for asserting non-fatal errors |
2014 | - |
2015 | + """ |
2016 | + expectThat is a tool for asserting non-fatal errors |
2017 | + |
2018 | It should only be used as to assert non-fatal errors. Errors which it |
2019 | - doesn't make sense to halt the test if it fails. At the end of the test you need to |
2020 | - use the global non_fatal_errors list and test it is empty |
2021 | - |
2022 | + doesn't make sense to halt the test if it fails. At the end of the test you |
2023 | + need to use the global non_fatal_errors list and test it is empty |
2024 | + |
2025 | i.e self.assertThat(len(non_fatal_errors), Equals(0)) |
2026 | - |
2027 | + |
2028 | If there are errors then in your test pass each error to self.addDetail() |
2029 | and finally re-raise the exception so we get a failed test. |
2030 | - |
2031 | - This will result in the formatted exceptions stored in the non_fatal_errors list |
2032 | - being printed to the test result |
2033 | - |
2034 | + |
2035 | + This will result in the formatted exceptions stored in the non_fatal_errors |
2036 | + list being printed to the test result |
2037 | + |
2038 | """ |
2039 | |
2040 | def __init__(self, value): |
2041 | self.value = value |
2042 | |
2043 | - |
2044 | def __getattr__(self, name): |
2045 | return getattr(super(expectThat, self), name) |
2046 | |
2047 | @@ -58,8 +58,8 @@ |
2048 | #now som rich comparisons |
2049 | #all we really need is just ==, != and is_unicode and a contains |
2050 | def __eq__(self, compareValue, msg=None): |
2051 | - message = "Expected {0} but instead we got {1}".format(repr(compareValue), |
2052 | - repr(self.value)) |
2053 | + message = "Expected {0} but instead we got {1}".format( |
2054 | + repr(compareValue), repr(self.value)) |
2055 | try: |
2056 | assert self.value == compareValue, message |
2057 | except AssertionError: |
2058 | @@ -84,8 +84,8 @@ |
2059 | if msg: |
2060 | message = msg |
2061 | else: |
2062 | - message = "Expected {0} to equal {1} but it doesn't!!".format(repr(compareValue), |
2063 | - repr(self.value)) |
2064 | + message = "Expected {0} to equal {1} but it doesn't!!".format( |
2065 | + repr(compareValue), repr(self.value)) |
2066 | try: |
2067 | assert self.value == compareValue, message |
2068 | except AssertionError: |
2069 | @@ -93,7 +93,7 @@ |
2070 | global non_fatal_errors |
2071 | e = traceback.format_exc(limit=5) |
2072 | non_fatal_errors.append(e) |
2073 | - |
2074 | + |
2075 | def not_equals(self, compareValue, msg=None): |
2076 | if msg: |
2077 | message = msg |
2078 | @@ -110,11 +110,11 @@ |
2079 | non_fatal_errors.append(e) |
2080 | |
2081 | def is_unicode(self, msg=None): |
2082 | - if msg: |
2083 | + if msg: |
2084 | message = msg |
2085 | else: |
2086 | - message = "Expected to be instance of type 'unicode' but is an instance of type '{0}'".format( |
2087 | - self.value.__class__.__name__) |
2088 | + message = "Expected to be instance of type 'unicode' but is an "\ |
2089 | + "instance of type '{0}'".format(self.value.__class__.__name__) |
2090 | try: |
2091 | assert isinstance(self.value, str), message |
2092 | except AssertionError as e: |
2093 | @@ -126,7 +126,8 @@ |
2094 | if msg: |
2095 | message = msg |
2096 | else: |
2097 | - message = '{0} does not contain {1}.'.format(repr(self.value), repr(compareValue)) |
2098 | + message = '{0} does not contain {1}.'.format( |
2099 | + repr(self.value), repr(compareValue)) |
2100 | try: |
2101 | assert compareValue in self.value, message |
2102 | except AssertionError as e: |
2103 | @@ -138,8 +139,8 @@ |
2104 | if msg: |
2105 | message = msg |
2106 | else: |
2107 | - message = 'Expected {0} to almost equal {1}, but it doesnt'.format(repr(self.value), |
2108 | - repr(compareValue)) |
2109 | + message = 'Expected {0} to almost equal {1}, but it '\ |
2110 | + 'doesnt'.format(repr(self.value), repr(compareValue)) |
2111 | try: |
2112 | result = self._approx_equal(self.value, compareValue) |
2113 | assert result, message |
2114 | |
2115 | === modified file 'autopilot/ubiquity_autopilot_tests/unittests/test_matchers.py' |
2116 | --- autopilot/ubiquity_autopilot_tests/unittests/test_matchers.py 2013-11-01 10:04:29 +0000 |
2117 | +++ autopilot/ubiquity_autopilot_tests/unittests/test_matchers.py 2013-11-19 09:56:21 +0000 |
2118 | @@ -12,4 +12,3 @@ |
2119 | |
2120 | if __name__ == '__main__': |
2121 | unittest.main() |
2122 | - |
2123 | |
2124 | === modified file 'tests/run-pep8' |
2125 | --- tests/run-pep8 2013-08-29 00:23:26 +0000 |
2126 | +++ tests/run-pep8 2013-11-19 09:56:21 +0000 |
2127 | @@ -4,4 +4,4 @@ |
2128 | |
2129 | pep8 --exclude keyboard_names.py --exclude Keyboard.py \ |
2130 | $(grep -lr '#!.*bin/python' bin) \ |
2131 | - scripts tests tests/run tests/run-frontend ubiquity |
2132 | + scripts tests tests/run tests/run-frontend ubiquity autopilot |
LGTM, i've changed the warnings in my editor so this shouldn't happen again. Thanks for cleaning it up :-)