Brendan Donegan has proposed merging lp:~brendan-donegan/ubuntu-clock-app/disable_location_prompt into lp:ubuntu-clock-app.
Commit message: Disable the location service prompt for testing purposes Requested reviews: Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot): continuous-integration Leo Arias (elopio) Related bugs: Bug #1425044 in Ubuntu Clock App: "Tests fail with location popup" https://bugs.launchpad.net/ubuntu-clock-app/+bug/1425044 For more details, see: https://code.launchpad.net/~brendan-donegan/ubuntu-clock-app/disable_location_prompt/+merge/242682 Disable the location service prompt for testing purposes -- Your team Ubuntu Clock Developers is subscribed to branch lp:ubuntu-clock-app.
=== added file 'tests/autopilot/ubuntu_clock_app/fixture_setup.py' --- tests/autopilot/ubuntu_clock_app/fixture_setup.py 1970-01-01 00:00:00 +0000 +++ tests/autopilot/ubuntu_clock_app/fixture_setup.py 2014-11-27 12:27:57 +0000 @@ -0,0 +1,44 @@ +# Copyright (C) 2014 Canonical Ltd +# +# This file is part of Ubuntu Clock App +# +# Ubuntu Clock App is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3 as +# published by the Free Software Foundation. +# +# Ubuntu Clock App is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Clock app autopilot fixtures.""" + +import fixtures +import logging +import subprocess + + +class LocationServiceTestEnvironment(fixtures.Fixture): + + def setUp(self): + super(LocationServiceTestEnvironment, self).setUp() + self._set_location_service_testing(True) + self.addCleanup(self._set_location_service_testing, False) + + def _set_location_service_testing(self, test_mode): + test = 'true' if test_mode else 'false' + try: + subprocess.check_call( + 'sudo setprop custom.location.testing {}'.format(test), + shell=True) + subprocess.check_call( + 'sudo restart ubuntu-location-service && ' + 'restart ubuntu-location-service-trust-stored', + shell=True) + except subprocess.CalledProcessError: + logger = logging.getLogger(__name__) + logger.error('Unable to start location service in testing mode ' + 'tests may fail as a result.') === modified file 'tests/autopilot/ubuntu_clock_app/tests/__init__.py' --- tests/autopilot/ubuntu_clock_app/tests/__init__.py 2014-08-20 22:51:45 +0000 +++ tests/autopilot/ubuntu_clock_app/tests/__init__.py 2014-11-27 12:27:57 +0000 @@ -29,7 +29,7 @@ emulators as toolkit_emulators ) -from ubuntu_clock_app import emulators +from ubuntu_clock_app import emulators, fixture_setup logger = logging.getLogger(__name__) @@ -60,7 +60,7 @@ # backup and wipe db's before testing self.temp_move_sqlite_db() self.addCleanup(self.restore_sqlite_db) - + self.useFixture(fixture_setup.LocationServiceTestEnvironment()) launch, self.test_type = self.get_launcher_method_and_type() self.useFixture(fixtures.EnvironmentVariable('LC_ALL', newvalue='C')) super(ClockAppTestCase, self).setUp()
-- Mailing list: https://launchpad.net/~ubuntu-touch-coreapps-reviewers Post to : ubuntu-touch-coreapps-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~ubuntu-touch-coreapps-reviewers More help : https://help.launchpad.net/ListHelp