Merge lp:~canonical-platform-qa/address-book-app/remove-teardown-ap-tests into lp:address-book-app

Proposed by Christopher Lee
Status: Needs review
Proposed branch: lp:~canonical-platform-qa/address-book-app/remove-teardown-ap-tests
Merge into: lp:address-book-app
Diff against target: 68 lines (+27/-10)
1 file modified
tests/autopilot/address_book_app/tests/__init__.py (+27/-10)
To merge this branch: bzr merge lp:~canonical-platform-qa/address-book-app/remove-teardown-ap-tests
Reviewer Review Type Date Requested Status
Federico Gimenez (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Vincent Ladeuil (community) Needs Information
Leo Arias (community) Approve
Ubuntu Phablet Team Pending
Review via email: mp+258829@code.launchpad.net

Commit message

Test now uses addCleanup to re-start the OSK.

Description of the change

Test now uses addCleanup to re-start the OSK.
I had an issue where the OSK wasn't started after a test which caused the following tests to fail when they tried to stop an already stopped service.

To post a comment you must log in.
430. By Christopher Lee

User a fixture instead.

431. By Christopher Lee

Oops, forgot to re-raise

Revision history for this message
Leo Arias (elopio) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Vincent Ladeuil (vila) wrote :

See inline question.

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
432. By Christopher Lee

Actuall log error message from command call

Revision history for this message
Christopher Lee (veebers) wrote :

> See inline question.
Good point, now logging better details.

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

LGTM

review: Approve

Unmerged revisions

432. By Christopher Lee

Actuall log error message from command call

431. By Christopher Lee

Oops, forgot to re-raise

430. By Christopher Lee

User a fixture instead.

429. By Christopher Lee

Remove need for tearDown using addCleanup

428. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

427. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

426. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/address_book_app/tests/__init__.py'
--- tests/autopilot/address_book_app/tests/__init__.py 2015-04-14 22:19:01 +0000
+++ tests/autopilot/address_book_app/tests/__init__.py 2015-05-14 04:42:25 +0000
@@ -16,6 +16,8 @@
1616
17"""address-book-app autopilot tests."""17"""address-book-app autopilot tests."""
1818
19import fixtures
20import logging
19import os21import os
20import time22import time
21import subprocess23import subprocess
@@ -28,6 +30,30 @@
28import ubuntuuitoolkit30import ubuntuuitoolkit
29from ubuntuuitoolkit import emulators as toolkit_emulators31from ubuntuuitoolkit import emulators as toolkit_emulators
3032
33logger = logging.getLogger(__name__)
34
35
36class DisableOnScreenKeyboard(fixtures.Fixture):
37 """Disable the OSK for the time of the test (Does nothing on desktop)."""
38
39 def setUp(self):
40 super().setUp()
41 if model() != 'Desktop':
42 self.toggle_keyboard(state='stop')
43 self.addCleanup(self.toggle_keyboard, state='start')
44
45 def toggle_keyboard(self, state):
46 try:
47 subprocess.check_output(
48 ['/sbin/initctl', state, 'maliit-server'],
49 stderr=subprocess.STDOUT
50 )
51 except subprocess.CalledProcessError as e:
52 logger.error(
53 'Failed to toggle state of keyboard to: {state}\n'
54 'Error message: {msg}'.format(state=state, msg=e.output))
55 raise
56
3157
32class AddressBookAppTestCase(AutopilotTestCase):58class AddressBookAppTestCase(AutopilotTestCase):
33 """A common test case class that provides several useful methods for59 """A common test case class that provides several useful methods for
@@ -45,9 +71,7 @@
45 self.pointing_device = toolkit_emulators.get_pointing_device()71 self.pointing_device = toolkit_emulators.get_pointing_device()
46 super(AddressBookAppTestCase, self).setUp()72 super(AddressBookAppTestCase, self).setUp()
4773
48 # stop vkb74 self.useFixture(DisableOnScreenKeyboard())
49 if model() != "Desktop":
50 subprocess.check_call(["/sbin/initctl", "stop", "maliit-server"])
5175
52 if 'AUTOPILOT_APP' in os.environ:76 if 'AUTOPILOT_APP' in os.environ:
53 self.app_bin = os.environ['AUTOPILOT_APP']77 self.app_bin = os.environ['AUTOPILOT_APP']
@@ -86,13 +110,6 @@
86 AddressBookAppTestCase.ARGS = []110 AddressBookAppTestCase.ARGS = []
87 self.main_window.visible.wait_for(True)111 self.main_window.visible.wait_for(True)
88112
89 def tearDown(self):
90 super(AddressBookAppTestCase, self).tearDown()
91
92 # start the vkb
93 if model() != "Desktop":
94 subprocess.check_call(["/sbin/initctl", "start", "maliit-server"])
95
96 def launch_test_local(self):113 def launch_test_local(self):
97 return self.launch_test_application(114 return self.launch_test_application(
98 self.app_bin,115 self.app_bin,

Subscribers

People subscribed via source and target branches